DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.

First thing I notice is you have some really long waits in your socket communications, have you tried taking those waits out?  In my experience opening a socket is pretty fast. You have 2.5 seconds of wait time between the send, the receive and using the coordinates. We generally have at most 100 ms delay between sending multiple writes to the server but if I’m sending a request and waiting for a response those lines are written back to back. 

That’s where I would start to look at reducing times. You could then look to open the socket just once for the program and use that open socket, we do that as well but it needs to be a connection that is long lived so that the server doesn’t close the connection if data is not received for a period of time. I do not recommend to just keep opening sockets in a thread as you would be opening a lot of unneeded sockets and could cause performance issues on the robot or the server. Unfortunately UR does not provide any methods for determining if the socket is open or closed, so you could write your own where you make a request to the server and so long as it does not time out you know the server connection remains open, on a timeout event you could reopen the socket. 

In my experience though its not a huge detriment unless I’m talking to the server non-stop. Then UR has a better tool for that called xmlrpc but it requires you to have an xmlrpc server not just a simple tcp socket. Once you understand how to write the server, and there are libraries to do that depending on what language you are using, they are very easy to use and very performant. We are sending multiple commands within a single sync cycle of the robot.