I have developed a URCap with an InstallationNode, a ProgramNode and a ToolbarNode for a custom end-effector.
The InstallationNode starts a Python Daemon and sets up RS485 comms over the Tool I/O and RTDE communications.
The ProgramNode works perfectly - I can generate and run a URScript that sends and receives serial commands/responses over the Tool I/O RS485 to our custom end-effector.
The ToolbarNode has some buttons for sending commands on-demand over the Tool I/O RS485 to the custom end-effector.
Testing on a UR5e running Polyscope 5.18:
- From a fresh start, if I start the Python Daemon, RS485 and RTDE comms in the InstallationNode, and I open the Toolbar and press any of the buttons, not only does it not work, but Polyscope freezes completely and I have to restart the controller.
- However, from a fresh start, if I start the Python Daemon, RS485 and RTDE comms in the Installation Node, and I run a program (any program on; even if it just contains a Wait command), then launch the Toolbar, it works perfectly.
The URCap adds the following preamble to the urscript via my InstallationNodeContribution class:
@Override
public void generateScript(ScriptWriter writer){
if (isDaemonRunning()){
writer.assign("RPC", "rpc_factory(\"xmlrpc\", \"http://127.0.0.1:" + XmlRpcDaemonInterfact.RPC_PORT + "/RPC2\")");
writer.appendLine("set_tool_communication(True,115200,0,1,1.5,3.5");
writer.appendLine("RPC.serialStart()");
}
}
I suspect that these few lines are why the Toolbar works after running a program. Is this a fair assumption?
In the Toolbar, I am already checking that the serial port is open, that rtde is running and that the xmlrpcserver is reachable. So it seems to me that the only thing left to do is “set_tool_communication”, but I can’t find the Java equivalent of this.
Any help is greatly appreciated.