Universal Robots Forum

Realtime control

Hello!

I have an UR5 that I want to control realtime, setting the TCP to coordinates generated realtime too by an external computer. I have been using Python + urx to send programs, but there’s a ≈0.5 seconds stop between each program sent.

How can I control it like in this video, where it seems that the robot is just waiting for a continuous stream of coordinates? https://video.universal-robots.com/1to1-telerobotics-extender-by

Is it using RTDE? I see how to read positions (outputs) but not how to set them.

Thanks!

Marc

1 Like

You will want to check the servoj command. Essentially you bypass the controller’s path planning and stream directly a list of joint targets that the robot tries to track as fast as possible (with some parameters on how “aggressive” you want to track the target pose).

The naive way we tried at first is to stream servoj commands over the realtime interface, which “kind of works” but the control loop requires strict timing so if you drop commands because of OS lag or network congestion your bot will jitter like crazy.

We moved to having a local program sending constantly the servoj with the joint targets stored in the RTDE buffer, and we update remotely the RTDE buffer. This is how ROS implements realtime remote control and I think is the recommended way to do it since you guarantee sending servoj at precise interval since you’re generating that locally on the robot controller, and you only manipulate the target remotely via RTDE messages so it’s not as time-critical if you miss the 125Hz update mark.

1 Like

I would be also interested in this topic. Does one of you know some example code or a project where this is implemented, preferably in Python for easy and fast testing?

We modeled our current realtime setup by studying the sources there https://github.com/Mandelbr0t/UniversalRobot-Realtime-Control

Essentially a light program is sent to the controller, doing a simple lookup of RTDE float buffer values as a 6 joints pose, and formats it as a servoj command and sync, then you remotely update the RTDE float buffer values. This makes sure that if you drop frames over network the servoj command is still sent at the proper 125Hz update rate and the robot wont jitter. By using the servoj command you will always be slightly lagging behind your actual target, even if using aggressive gain and lookahead values. From our research the “ultimate” way to realtime control the bot is to use the speedj command with a control loop so you can be closer to the target than with a simple proportional control loop as servoj is doing, but the current setup is good enough for us.