Tool Modbus RTU URCap question

Hi!

I have a question about this URCap that enables communication via Modbus RTU.

I’ve managed to use the script functions in the programNode when the program is running.

But I wish to use the init_tool_modbus() script before the program is started so that one can read gripper temp, position and so on. I also wish to be able to run a homing sequence before the program can start.
But when I use the function (init_tool_modbus()) in a installationNode, it fails and gives fail code “init_tool_modbus(1) is not initialized to a value”.

please help!

// Oliver

Hi Oliver,

This Project is demonstrating how to send URScript from the frontend. I hope that will help you on your way! Please be aware that installation configuration is set in the URScript generated by Polyscope.

Ebbe

Hi Ebbe!
Thank you for the quick reply!

I tried to create a script from the InstallationNode with these commands.

// Set tool voltage and communication
writer.appendLine(“set_tool_voltage(12)”);
writer.appendLine(“set_tool_communication(True, 57600, 2, 1, 1.5, 3.5)”);
// Connect with motor at specified address
writer.appendLine(“init_tool_modbus(1)”);

and afterwards I tried to read/write values from the gripper…
But it doesn’t work.

I don’t know how to start the communication between the gripper and Polyscope without putting
the init_tool_modbus(1) inside the ProgramNode generateScript() function.

// Oliver

I would suggest that your InstallationNodeContribution add it in its generateScript() method.

Did you try from the loaded Polyscope program or did you also sent that directly to the controller?

Ebbe

I’m now able to read/write data to the motors register, from the InstallationNode!

I used while loop inside the scriptSender but as soon as I removed it from the script, the gripper started to move.
I had to define the Modbus script functions tool_modbus_read() & tool_modbus_write() in every Send URScript commands from the ScriptCommunicator URCap.

Thanks for the help Ebbe!

1 Like