---
date: 2025-11-23
---

# Universal Robots real-time data exchange (RTDE) using C#

:::{card} Background
A colleague and me wanted to find a C# library for controlling a [Universal Robots UR3 robot arm](https://www.universal-robots.com/products/ur3-robot/) with an [OnRobot RG2 gripper](https://onrobot.com/en/products/rg2-gripper) for using in an [industrial programming-related course](https://kurser.dtu.dk/course/62236). 
:::

At the end I saw that it requires about a dozen C# lines to activate the robot and send the robot program. I reverse engineered the URScript RPC commands by storing an example URScript created by the UR operating system on a USB stick.

<https://industrial-programming.aydos.de/week08/item-sorter-robot-real.html>

In the first iteration of the course we had bought the UniversalRobots.NET library.

## Related links
Here is an overview of resources I researched:

- <https://gitlab.com/sdurobotics/ur_rtde>: A high-quality open-source C++ library from SDU with Python bindings. It can automatically load the control script for the robot and even restart it after a safety lock. 

- <https://github.com/RyanPaulMcKenna/onRobot>: A low-quality Python library, but it is the only one that I could find that can interface with the UR robot. It can get the gripper width and apply width along with force.


- <https://sourceforge.net/p/firsttestfchaxel/code/HEAD/tree/trunk/Ur_Rtde>: An undocumented C# library, which lacks functions like automatic loading of control script and inverse kinematics for controlling the gripper in base coordinates.

- <https://github.com/takuya-ki/onrobot-rg>: Python library for some OnRobot grippers. Can only interface the control box of the gripper directly.

- [RoboDK](https://robodk.com): Commercial simulator and programmer with support for most industrial robot arms. Features a [C# API](https://robodk.com/doc/en/RoboDK-API-API.html). This solution is non-free and probably abstract *too* much for a C# programming course.

- [UniversalRobots](https://github.com/underautomation/UniversalRobots.NET): A high-quality commercial C# library for RTDE that must be licensed. They provide an academic license with ~40% off at 594 EUR. According to UnderAutomation it is a perpetual license independent of how many students or robots.