SintefManufacturing / python-urx

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

Freedrive mode not working? #11

Closed broofa closed 7 years ago

broofa commented 8 years ago

Hi, I'm working with a UR5, trying to put it into freedrive mode. URRobot.set_freedrive(True) does not seem to be working. Reading the urx code it looks like it's sending set robotmode freedrive, however in reading the v3.2 of the URScript Programming Language guide, I don't see any mention of a robotmode command. Am I missing something?

(Note: I'm new to this so my apologies if I'm overlooking something obvious.)

Cc: @markwsilliman

oroulet commented 8 years ago

It used to work..., We'll check

On Tue, Aug 23, 2016, 02:18 Robert Kieffer notifications@github.com wrote:

Hi, I'm working with a UR5, trying to put it into freedrive mode. URRobot.set_freedrive(True) does not seem to be working. Reading the urx code it looks like it's sending set robotmode freedrive, however in reading the v3.2 of the URScript Programming Language guide, I don't see any mention of a robotmode command. Am I missing something?

(Note: I'm new to this so my apologies if I'm overlooking something obvious.)

Cc: @markwsilliman https://github.com/markwsilliman

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SintefRaufossManufacturing/python-urx/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/ACcfznsASt34JZuBmr_7oyFz4031pVu3ks5qijxVgaJpZM4Jqbu9 .

zchen24 commented 7 years ago

In my lab, there are one UR3 running 3.1 and one UR5 running 1.8. This "set robotmode freedrive" command works on UR5, but does not work on UR3.

markwsilliman commented 7 years ago

We're using this on a UR5 now that is running 3.4 so I would expect 3.1 to work. One trick that we had to do is create a script to sleep after enabling freedrive. Otherwise the program ends and freedrive turns off (all in < 1 second).

Check your logs (on the robot) to see if the freemode is turning on and off. If yes adding the sleep will fix it.

zchen24 commented 7 years ago

@markwsilliman Could you elaborate on "create a script to sleep after enabling freedrive"? On UR3, I also tried to call freedrive_mode() and found that the UR turns freedrive mode on, then turns it off after 16 ms.

markwsilliman commented 7 years ago

Try something like:

with urx.Robot(robot_ip) as rob: rob.send_program(b"def myProg():\n\tfreedrive_mode()\nsleep({})\nend".format(timeout))

zchen24 commented 7 years ago

WOW, works like a charm. Thank you!