I have a problem. I’m trying to comunicate via modbus the UR to a CMMO festo motor controller (slave).
I have to send this:
Slave number: 00
Function code: 10
Memo Dir: 0000
Number of words: 0004
I’ve try using the URScript function modbus_send_custom_command() like this:
But nothing happends.
I would verify the sent modbus packet with a Socket Test server (http://sockettest.sourceforge.net/) to see if the packet is correct.
Please beware of endianness.
The easiest way to test if your Modbus code is formally done right, is to use the general purpose registers, e.g. 128-131 on the UR robot. Just go to the Modbus tab, set the IP to localhost and add the signals. Then change the IP in your Modbus to localhost and try it out. However, the Modbus code seems all right - as I see it - so you should check how you have configured Modbus in Festo Configuration Tool - for instance that you send the right number of words.
I’ve noticed that the problem is that the function creates a buffer and introduces each function to the buffer. Then it does not stop sending the functions in a loop, although from the program it indicated that it only runs once, even if i stop the program, i continue receiving the packets.
How can i specify to send the instrucction one time?
Currently there is no way to send one off modbus commands in the application, but I think it’s great feature request for modbus client.
Oh, I see! As a matter of fact, I have unfortunately also faced the very same problem. From my experience, I have learned that there is a solution but it is not straight-forward. However, if your UR robot supports URCaps, and you are up for the challenge, here is what you can do:
- Create your own application in C++ or Python containing the Modbus functions that you need.
- Add a XML-RPC server to your code which can share your functions to a XML-RPC client.
- Implement your application as a daemon in a URCap.
- Add a XML-RPC-client in the URCap which connects to the deamon server.
- Install the URCap.
Hereby you should be able to call your Modbus functions in the daemon via XML-RPC commucation. If your UR robot supports Python 2.7 (CB3.1), I can recommend using the pymodbus 1.4.0 library which is released under the BSD License: http://pymodbus.readthedocs.io
I hope that this is useful on some level until UR improves the Modbus client ability on the robot.