Home Programming


Left ArrowBack to discussions page
Ruben_SpeybrouckRuben_Speybrouck Posts: 18 Apprentice
I would like to send information from the robot to my python program and back. Universal seems to have a pretty cool RTDE protocol for this, sadly I cannot for the life of me figure it out and there is no documentation. I manage to read all the variables, but not write. 

I see that socket communication is also an option and that there is an open_socket command hidden in the documentation. 

I just need the robot to tell my python script what it has picked up so that other equipment can perform some actions and confirm done. How would you guys go about this? 


  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    UR has good example files written in Python at https://www.universal-robots.com/articles/ur/interface-communication/real-time-data-exchange-rtde-guide/

    if you download the zip file at the bottom there are examples in that file. These are what we used to develop our servers from. 
  • Ruben_SpeybrouckRuben_Speybrouck Posts: 18 Apprentice
    @matthewd92 thanks for the reply. I looked at RTDE a bit and figured out how to read data. 

    From the documentation, I gather I can also set input_double_register_X to some value of my choice from python. 
    However, I cannot figure out how I turn these registers into variables inside the pendant program? 

    I want to for example get the robot to put a value into this register when it has successfully picked a part. 'READY'. 
    Then I want my python program to change it to 'SUCCESS' or 'FAIL' when some other equipment has manipulated it and use this variable in an if statement in my pendant/urscript program. 

    How do I access these registers as variables? 
  • Ruben_SpeybrouckRuben_Speybrouck Posts: 18 Apprentice
    To put it in more explicit terms: How do I change a register from python and assign its value to a variable on the pendant? 
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    You’ll have to have a thread that monitors the register on the robot and assigns the value to a variable.  Your code can also just use the register. 
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    Also, the robot will write to one register and the RTDE will write to another register. There are input and output registers. The robot will write to an output register and the RTDE will write to an input register which the robot can monitor. 
  • Ruben_SpeybrouckRuben_Speybrouck Posts: 18 Apprentice
    Hi @matthewd92

    Thanks for getting back to  me. That makes sense. I finally ended up just using TCP and the socket_open() and socket_read_string() commands. This was very confusing at first as these functions do not actually exist as options from the pendant dropdown menu, but if you write them manually, they do work. 

    For anyone in the future wondering, i advise this guide: https://www.zacobria.com/universal-robots-zacobria-forum-hints-tips-how-to/script-client-server-example/
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    Glad you were able to make it work. There is a lot of information in the UR script manuals as well, available from the UR support site. There are a lot of scripts available with only a handful of the most commonly used ones available from the pendant. 
  • GrustaGrusta Unconfirmed Posts: 1 Recruit
    Hello, I have try the example but I don't understant why the numbers in the vector don't match with the TCP Position 
Sign In or Register to comment.
Left ArrowBack to discussions page