How to process package from robot controller

In that case RTDE all the way then! It’s much easier to work with. It’s pretty straightforward to modify the example programs included in the zip file at the bottom of this article to read actual_q and actual_qd outputs.

https://www.universal-robots.cn/articles/ur/interface-communication/real-time-data-exchange-rtde-guide/

Great to hear that RDTE is the way to go. I’ve never been able to understand how to use that example at that link, but I found a number of simple examples here (examples/py · master · SDU Robotics / ur_rtde · GitLab) using the ur_rtde library, and was able to get them to work to monitor actual_q and actual_qd.

One related question – this document (Remote Control Via TCP/IP - 16496) states that “If you need to monitor the robot state both in remote and local modes, you should use the ports 30004” – but, when I try to run any of the RTDE programs above, I get an error that I have to put my robot (UR3e) into remote mode. Any ideas why?

I haven’t used SDU robotics rtde library much, but my guess would be that you’re inadvertently accessing one of the other interfaces too with some functionality of that library besides just accessing port 30004. I just did a simple test with it to read an output state and it didn’t complain about being in local mode.

Also quickly modified the standard UR rtde library example to read actual_q and actual_qd once then exit, hope this helped to explain how to use this one too.

example_actual_q_qd.zip (1.7 KB)

1 Like

Hi!

I am trying to modify your code to look through the variables in the Robot mode data. However, when i check for which message type the subpackage is:

msgtype = (struct.unpack(’!b’, data[9 + i]))[0]

I get the following error: TypeError: a bytes-like object is required, not ‘int’

I get that i have to check for a subpackage of type == 0 to look for Robot mode data, however, i can’t get the correct values and with the TypeError i seem to be stuck.

I’d like to get all the data for isRealRobotConnected, isRealRobotEnabled, isRobotPowerOn, bool isEmergencyStopped, isProtectiveStopped, isProgramRunning and isProgramPaused. Is there any way you can help, or point me in the right direction?