Home› Programming
Discussion
Back to discussions page
jonlong
Posts: 3 Apprentice
Strange/broken behavior with URScript |
1.1K views
|
Answered | |
/ Most recent by PierreOlivier_Proulx
in Programming
|
27 comments |

in Programming
I have a Robotiq 85 2-finger gripper that I'm using with a UR5 running version 3.3.2.266, and would like to control remotely (presumably via URScript).
Perhaps I have missed something basic, but this does not seem to be working, and behaves in ways I would not expect.
When I run "gripper_tutorial.urp" from the pendant, that does work. But when I single-step through any of the rq_* commands (using the >| button on the bottom of the pendant display), I get a compile error, e.g., "Compile error: name 'rq_close' is not defined". Likewise, sending rq_* commands over a socket does not work; there does not seem to be any effect.
I can control the gripper remotely using raw socket commands from URScript, e.g., socket_set_var("POS", 255, "gripper_socket"). But that does not seem to work reliably, and does not seem like the right way to do things given the presence of the rq_* commands.
Any idea what might cause this behavior? Have I missed some initialization step? Shouldn't I be able to send "rq_close()" (e.g.) over a URScript socket?
Perhaps I have missed something basic, but this does not seem to be working, and behaves in ways I would not expect.
When I run "gripper_tutorial.urp" from the pendant, that does work. But when I single-step through any of the rq_* commands (using the >| button on the bottom of the pendant display), I get a compile error, e.g., "Compile error: name 'rq_close' is not defined". Likewise, sending rq_* commands over a socket does not work; there does not seem to be any effect.
I can control the gripper remotely using raw socket commands from URScript, e.g., socket_set_var("POS", 255, "gripper_socket"). But that does not seem to work reliably, and does not seem like the right way to do things given the presence of the rq_* commands.
Any idea what might cause this behavior? Have I missed some initialization step? Shouldn't I be able to send "rq_close()" (e.g.) over a URScript socket?
Tagged:
Best Answer
-
matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,180 Handy
@jonlong Not that I'm aware of as those are not "native" features of the robot language. The Robotiq script is loaded into the robot memory at run time when you press play. The way it works on the robot is when you press play the program is compiled and all new script functionality is loaded at that time.
If you try to single step through the program those scripts are not loaded as the program is not actually being executed and therefore you get the error. My understanding is when you press the single step button you are actually compiling a small program for that step and then sending that one step to the controller as a program. To emulate that behavior you'd have to send as your program to the controller the entire Robotiq script file along with the one command you want to execute so that it's loaded in the run environment.
Sending the entire Robotiq script with each command does not sound very efficient; is there no efficient way to control the gripper over a socket while it's connected to the UR control box?
It sounds like I should just connect the serial port of the gripper externally to the UR control box; is that what you'd recommend?
How are the socket commands not being reliable? We do quite a lot (rather did, replaced not too long ago with RPC) with socket commands and never had any issue with them. We weren't controlling a gripper but communicating with an off-robot device over TCP/IP
What I meant about the socket commands is that simply calling "socket_set_var" over a URScript socket does not seem to reliably produce the expected response on the gripper (sometimes it does, sometimes nothing happens). The actual Robotiq implementation does a number of "sync" calls and has an ack-retry loop. I presume that that would work reliably, but again it's somewhat cumbersome to be sending that code as URScript for every gripper action...
For reference, I'm using and contributing to code here: https://github.com/SintefRaufossManufacturing/python-urx/blob/master/urx/robotiq_two_finger_gripper.py
I'm currently reaching out to Robotiq to see if an engineer has a better idea of how to handle this situation.
As as far as communicating to the gripper here's some documentation on how to do that via Modbus RTU over either the USB to RS485 converter or directly via RS485. We're doing something similar on another project but we write all of our code in nodejs. The biggest difference with that project is we are strictly reading data so no writing to the registers but it looks rather straightforward just briefly reading over the docs.
http://support.robotiq.com/download/attachments/5963876/2-Finger-Instruction-Manual-060716.pdf?version=1&modificationDate=1467835896840&api=v2#page54
Also just as a note, I do not warranty the code to be free from errors or bugs so use at your own risk....had to throw that out there you know
If anyone wants to work on this code as well let me know and I can add you as a contributor
Something that would be nice to have confirmed is if they all have the same address when you plug them in. I was able to find it pretty quick by looking in the /dev folder on my mac. @Etienne_Samson would you or one of the others have the answer to that question about the device address.
@cgilmer For an external library to control Robotiq devices, have a look at the ros-industrial robotiq package. https://github.com/ros-industrial/robotiq. Use the gripper manual for the communication protocol description.
Software Designer
[email protected]
That preamble is quite long but you can probably prune it and keep only the relevant functions for your case.
Software Designer
[email protected]
A better solution would be for me to talk directly over a socket connection to the gripper via the UR's built-in Modbus (as opposed to buying a separate modbus controller and connecting the gripper to it separately). I haven't been able to do this yet or I haven't figured out how to set up the modbus on the polyscope correctly to allow it.
My goals are really two-fold (and not exclusive):
1. Cause a blocking action on the gripper action so that no other commands run while the gripper is in motion. (this is applicable probably only to my setup)
2. Get the gripper state in real-time so I can figure out what's going on.
I haven't figured out how to do #1 (blocking action) so instead I have the timeout. For #2, I think the variables I want get set globally and output on the primary monitor (the polyscope) but these same variables aren't sent out to the secondary monitor, which is what I'm using to monitor the robot and thus the gripper state. I think this is more a problem with UR than with Robotiq.
This brings me back to my initial wish - that I could control the robotiq directly over the UR modbus interface. Any idea how to do this?
I still think that copying the whole preamble should work. URScript is very sensitive to indentation and it is not very verbose when problem occurs. Why not trying pasting the preamble but one function at a time to see the result incremantally.
Software Designer
[email protected]
Software Designer
[email protected]
Software Designer
[email protected]
Software Designer
[email protected]
Software Designer
[email protected]
The link as step 1 of the setup for this project seems broken, is there any other source for the driver, as it seems like a great project?
SETUP
|
| You must install the driver first and then power on the gripper from the
| gripper UI. The driver can be found here:
|
| http://support.robotiq.com/pages/viewpage.action?pageId=5963876
|
| FAQ
Also @Pierre, as we are newbies with URX, is yours a fork of this https://github.com/SintefRaufossManufacturing/python-urx and which is the best for us to start with?
Software Designer
[email protected]