SintefManufacturing / python-urx

Python library to control a robot from 'Universal Robots' http://www.universal-robots.com/
GNU Lesser General Public License v3.0
526 stars 275 forks source link

How to get a message to know if the robot has successfully moved to the defined position? #74

Closed kaixin-bai closed 3 years ago

kaixin-bai commented 5 years ago

just found this below in example code, is it possible to get a message to know whether the robot has successfully moved to the defined position, because the robot move sometimes 2s and sometimes 6s, but i don't want the robot always wait for a long time.

print("Waiting 2s for end move")
time.sleep(2)

Thanks a lot!

alejandro-colomar commented 3 years ago

Yes, the robot sends a status message every 0.1 seconds that's contains, among other fields, the position and velocity of the robot, so you can read that message every 0.1 seconds to have a bit more precise behavior

alejandro-colomar commented 3 years ago

You can check my C library for UR, although I haven't had access to a UR for more than a year, so it is untested (I introduced the changes to read the status message recently), and probably has important bugs, but may give you some idea of how it should work:

https://github.com/alejandro-colomar/libalx/tree/main/src/robot-ur