I musst write a URCap and would like to receive any Data from the Modbus. I have test it with a function in the UR robot program.
(picture 1) That works fine. Now I have the script Communicator and test it in this URCap. For this I have change the Code in the Class View from the Program Node. (picture 2 and 3) When I click the Button then crash the simulator. Can anywhere help me.
Thanks a lot.
With what error message does the simulator crash on sending your request?
If you want to retrieve information over the Modbus Interface without the program already running, you would need to register the signal in the message you are sending first. From your programs automatically created script-code you have an insight in the script commandos used to add the modbus signal, which you are referring in your first picture.
Thanks for the quick reply.
The Robot program doesn’t run. I Open the ProgramNode from the URCap. Then i click the button and the system crashes. I must close the complete simulator. I doesn’t get a Error Message.
How can I register the signal in the message first?
I think the problem is this program line: String returnValue = exporter.exportStringFromURScript(exportTestCommand, “test”);
When i do this as a comment and i load this in the simulator, the system don’t crash. But it has no function.
This would indicate, that the command you send is not valid Script Code. If the there is an error in the script code, the provided function will not run. In the case of this URCap then there will no connection be established back to the server running on the URCap side for providing the variable name. I would recommend to first let the script code run directly in Polyscope.
In the Script Manual you can find a description on how to add a Modbus Signal. Alternatively you can setup your Modbus Communication within the installation and then review the generated Script Code of the Robot Program.
modbus_add_signal(“127.0.0.1”, 255, 129, 2, “test”, False)
Thank you very much.
I have found my mistake. Now it works.