Universal Robots Forum

Beginner help for UR RTDE

Hello, I have been learning to program a UR10 (I simulate the robot in Visual Components, and post process the program to create a script file), and using the data available, when running the script from the controller to do some analysis. I am relatively new to robot communications and coding. At the moment I am trying to understand RTDE, inputs and outputs and what all can be done. I am wondering if anyone could share their knowledge/experience so I can understand this all a bit more.

I am using the UR10 cb3 series – I am aware I am limited to the frequency of 125Hz. I am using python 2, and Spyder 3 to execute scripts.

I downloaded the rtde zip file available from : Real-Time Data Exchange (RTDE) Guide - 22229

From my laptop, I use a script that sends my script file to the robot (which is on the same network as the robot) from this link. For some reason I only use from “HOST”. It seems to work ok. I use port 30003.

I run the ‘record.py’ file, when running through a program. From what I understand, it imports and uses code from the ‘rtde’ folder. I am not entirely sure how everything works in the scripts in the rtde file, but from the CSV file that the ‘record’ script populates that the data is coming in at 125Hz, i.e. one row of data every 0.008seconds.

I have ‘parser.add_argument(’–port’, type=int, default=30004, help=‘port number (30004)’)’.

So I think this data is being received from the 30004 port?

I can understand the data being output, like temperature in each joint, until I get to terms like ‘standard_analog_’, ‘output_bit_registers’. Outside the output terms on the page Real-Time Data Exchange (RTDE) Guide - 22229 I am not really sure what the rest the information is telling me. I am assuming this is because I am unfamiliar with ‘communication’ field.

What I would primarily like to understand and use is ‘ROBOT CONTROLLER INPUTS’. Is it correct that this is information you can send to the robot? Can anyone help me with understanding these inputs, as a beginner I thought the only thing you could send to a robot was the script, i.e. robot positions, speed etc.! I am not sure what would happen if I sent this, and how this information is actually sent. Is it through the ‘control_loop.py’ file? I am also unfamiliar with the terms in this such as ‘recipe’ and ‘register’.

I have also come across the python package ur-rtde, has anyone used this or know how it differs from the scripts provided by UR? Introduction — ur_rtde 1.4.1 documentation

I would really appreciate any help/advice on my questions that will help me understand this topic more.

Thanks in advance! Lauren

Hello lmcgarry05,

Welcome to UR community!

I will try to summarize the main things about communication interfaces available in UR robots.

First of all, I will encourage you to take a look to this article, where there is an overview to all client interfaces:
https://www.universal-robots.com/articles/ur/interface-communication/overview-of-client-interfaces/

You also have this article, where there is a useful summary table of the different options to control the robot via TCP/IP:
https://www.universal-robots.com/articles/ur/interface-communication/remote-control-via-tcpip/

As you can see in the previous article, there are 4 main ports to communicate with: 30001 to 30004, and each one of them behaves differently regarding frequency, received data or sent data. For example, primary interface (port 30001) will accept URScript commands directly (same as you are doing with 30003), and will transmit a full message at 10 Hz frequency (10 times per second). This message that you will receive when connecting to 30001 is fixed (not configurable by user), and it’s described in detail in the excel file at the bottom of the article.

However, RTDE works a bit differently: you will not be able to send URScrip commands directly to 30004 port. Instead, there is a big map of input and output registers available, and you will be able to choose which of them you would like to read or write. In the RTDE article you have the complete list of registers available, and the type of data each one contains. A lot of them are basically read-only information about robot status (joint positions, joint velocities, TCP pose, TCP speed, joint temperatures… and a lot more). And there are also a bunch of empty registers available for you to write whatever data you need on them. Well, not whatever: basically bits, integers, or floats. Those are called General purpose registers.

And unlike the rest of the interfaces, in RTDE you will be able to choose which registers from that big list you would like to exchange, and how frequently you would like to do it (up to 500 Hz in eSeries, 125 Hz in CB3). The file that will allow you to choose which registers will you RTDE message contain is what we call ‘recipe’.

The record.py file that you mentioned will serve you to record the message received in a csv file, but if what you want to do is to not only read but also write on those registers, maybe you would need to use something more similar to the other one (control loop). For this, a program needs to be running in the robot controller to handle this data (read it or write it). From the robot side, you can access this data from PolyScope I/O Setup in the Installation Tab (Bit, Integer and Float Registers) or using the script codes associated.

I hope this helps you get started.
Guillermo

1 Like

On top of great summary made by @ggcr I can add that there is also ROS driver for UR robots: GitHub - UniversalRobots/Universal_Robots_ROS_Driver: Driver enabling ROS operation of UR robots.
Under the hood ROS driver is using all public interfaces.

If you still want to use RTDE directly, then you can think of “inputs” as a mean of communicating with a script running on a robot from outside world (PLC for example). “outputs” report various robot parameters in real time.

General purpose registers are easy way to pass arbitrary values between running program and external application.
On URScript side (manual can be downloaded UR Download | Support Site | Universal Robots) you can use read_input...register() and write_output...register() functions.

ur_rtde is another great project similar to ROS driver, however it’s not directly supported by UR.