Universal Robots Forum

External communication : Socket vs XMLRPC


I would like to extend capabilities of my robot with an external computer on the same network of the robot.
The idea is to have the main program in the robot and some calls are made to some external functions

The new functions would be the following :

  • communicate with an arduino mega to make rotate a motor+encoder
  • trigger an external camera, detect target on the image, and then send back a pose to the robot
  • launch a java program
  • wait action on the computer

I would like to have something flexible, to add some others functionnalities in the future.

To do so my idea is to have a server on the computer which redirect the commands and send back data to the robot.
My question is what kind of technology should I use : socket or XMLRPC or other ?

I will be grateful if you share your experience on the subject, so that I can take the best direction for my application.
I want to getoff ont the right foot :slight_smile:

Thanks for your help.


In our experience XMLRPC is faster communication to the robot and simpler to use on the robot, once you create the factory you do not need to control the socket connections. It’s also much easier to use as the commands are all dot notation, ie, if your RPC factory is called RPC then commands are RPC.someCommand() and can take variable length arguments.

We started with socket server but moved pretty quickly to the XMLRPC once we figured out what it was and all the advantages. We continue to use RPC exclusively for off robot communications where we need to talk with a server.

Hello Florent,

I also worked with a similar architecture:

  • For the robot / PC link, if you are in .NET C#, Python, or Labview, you can use the UnderAutomation library which allows you to remote control and monitor your robot (socket, primary interface, dashboard, XML-RPC, SSH, SFTP, …) : https://underautomation.com/

  • For the Arduino / PC link, there are several RPC libraries, in C# I use the open source Sharer library : GitHub - Rufus31415/Sharer: Arduino & .NET serial communication library to read/write variables and remote call functions using the Sharer protocol. Works on Windows, Linux and MacOS.

  • To trigger an external camera, it depends on your protocol. If you are simply in RTSP or Direct Show, you can use OpenCV and its various wrappers for Python or .NET like EmguCV. If you have more industrial protocols, like GigE Vision, you can use Halcon for example.

  • If you want to launch your application on the PC, it can be done in any language by calling an external command line, for example in C# : System.Diagnostics.Process.Start ("java", "your_program.jar"). If this java program is on the robot controller, the UnderAutomation library allows you to remotely execute this same command via SSH.

If your application is simple, you can start developing it in .NET for example.
If your application is more complex, you can use commercial SCADA software, but you have to find one that easily handles Arduino and UR…