Home› Programming
Discussion
Back to discussions page
Ruben_Speybrouck
Posts: 18 Apprentice
How to send data back and forth from python to universal robot |
2.8K views
|
Answered | |
/ Most recent by Grusta
in Programming
|
8 comments |
in Programming
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?
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?
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.
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?
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/