Home› Programming
Discussion
Back to discussions page
Rasp
Posts: 8 Apprentice
Programming options: UR16e + 2F-85 |
3.3K views
|
Answered | |
/ Most recent by bcastets
in Programming
|
16 comments |

Hi,
what is the best way to program the combination UR16e + 2F-85? I have successfully programmed the gripper from the teaching pendant with URCap nodes, however I want to explore python or c++ programming. I have also successfully programmed the arm via https://gitlab.com/sdurobotics/ur_rtde.
The questions I have are:
- According to UR's training https://academy.universal-robots.com/modules/e-Series%20core%20track/English/module2/story_html5.html?courseId=2165 , the gripper could be controlled by setting the digital output on the teaching pendant. This doesn't seem to work for 2F-85. Is this because this gripper requires the more complex API (rGTO and other vars), and the digital output is simply ignored or not connected?
- What are the main differences between connecting (from a unix machine) directly to the gripper (via port 63352) to send UR commands to the gripper, and connecting to the RTDE interface (via port 30004) so that a UR script running on the robot communicates with the gripper?
I have considered:
a) Uploading recipes directly following rtde-2.3.6's examples, and proper functions to the uploaded URScript (to mimic Robotiq's URScript), and use Python:
https://dof.robotiq.com/discussion/comment/3840 (the gripper script, similar to the one available in the teaching pendant)
b) Adding recipes to SDU's RTDE wrapper, and proper functions to the uploaded URScript (to mimic Robotiq's URScript), and use either C++ or Python:
https://dof.robotiq.com/discussion/comment/3840 (the gripper script, similar to the one available in the teaching pendant)
c) Connecting directly to the gripper, and using URX to upload URScript commands directly to the gripper?? I am unsure whether this also requires uploading the URCaps script to the gripper, or whether by connecting directly instead of through the controller the URCaps' functions are available as commands:
d) Connecting directly via MODBUS RTU
e) This unclear method through rs485 (looks similar to MODBUS RTU as stated in option 'd'):
Am I missing something?
- - - -
To summarize the questions:
To summarize the questions:
Q1) Why does digital output seem to have no effect on 2f-85, even though the teaching pendant / URcaps works?
Q2) What are the main differences between connecting directly to the gripper (via port 63352) vs connecting to the RTDE interface (via port 30004) and have the controller talk to the gripper?
Q3) I have listed several options, are there any pros/cons for either I should be aware of?
Thanks,
Sam.
Tagged:
Best Answers
-
bcastets Vacuum Beta tester Posts: 674 Expert
Q1) Why does digital output seem to have no effect on 2f-85, even though the teaching pendant / URcaps works?> Digital output and gripper control is not related. The gripper is connected via USB. Digital output are not used by the 2F.Q2) What are the main differences between connecting directly to the gripper (via port 63352) vs connecting to the RTDE interface (via port 30004) and have the controller talk to the gripper?
>The RTDE interface receive UR script. Then UR script is executed by the controller to perform an action. In case of the gripper, the controller will take the UR script and then convert this strict into Modbus RTU command with the support of gripper URCAP.
The direct connection to the gripper is more complex but more flexible. You can directly send modbus RTU command to the gripper. It is probably faster and you can communicate with your own why to the gripper.Q3) I have listed several options, are there any pros/cons for either I should be aware of?
a) Easy but slow because you have to send a lot of code for a simple gripper action.b) Not sure about the difference with a)
c) Don t know URX but I don t think it will help.
d) Easy and flexible but the gripper is not connected on the robot.
e) It looks like the best option. Gripper is connected on the robot and you are free to communicate in Modbus RTU. This solution is UR ROS package to emulate the gripper communication on the PC and control it in Modbus RTU. Did not had time to test it but it looks good. -
prier Posts: 2 Recruit
Hello Rasp
I am the author of ur_rtde. I have two suggestions for you.
1) (The proper way) Option e)
Download the rs485-1.0.urcap from here, install it on the robot and remember to remove the Robotiq_Grippers UR cap as these two
cannot function together. You can then use the tool_communication script for making the robotiq serial port available on your desktop. (eg. /tmp/ttyUR). Finally use a modbus RTU based driver to communicate through the serial port. Alternatively you can avoid running the tool_communication script and just communicate directly to the socket at the port specified in the rs485 cap (default is 54321).
2) (The not so proper way) Option b)
You can send the robotiq preamble script together with the function you want to run, using the sendCustomScriptFunction() of the rtde_control interface. (Unfortunately you have to send over the preamble with the gripper api functions everytime, it does give a bit of delay). Attached you will find some example code in python with the preamble embedded. It exposes a RobotiqGripper class, that can be used together with ur_rtde like the following:from robotiq_gripper import RobotiqGripper
from rtde_control import RTDEControlInterface
import time
rtde_c = RTDEControlInterface("<ROBOT_IP>")
gripper = RobotiqGripper(rtde_c) # Activate the gripper and initialize force and speed
gripper.activate() # returns to previous position after activation
gripper.set_force(50) # from 0 to 100 %
gripper.set_speed(100) # from 0 to 100 %
# Perform some gripper actions
gripper.open()
gripper.close()
time.sleep(1)
gripper.open()
gripper.move(10) # mm
# Stop the rtde control script
rtde_c.stopRobot()
Robotiq_Grippers URcap, which accepts ASCII commands instead? I was even able to command the gripper using https://sourceforge.net/projects/sockettest/ . This is how Robotiq_Grippers URcap seems to implement teaching pendant nodes.
I was actually not aware that you could communicate directly to the robotiq socket at 63352, that seems like a great solution. It is likely a better option than using the rs485 cap, since you cannot run the Robotiq_grippers cap together with that. If you are in a position to share the code, I would be interested.
So for your questions.
- Is there a reason why the script and recipes can't be data-driven, instead of hard-coded (the script loads as .h)?
- Is there a way to speed up compilation for fast iteration? I did not look too much into it, but the culprit looks like boost linking.
About the delays introduced by the acknowledge process, this is something that I am currently looking into. I have done some changes for servo and speed commands, that makes these a lot faster the 7-8ms delay is reduced to ~20 microseconds.No, however initially my reason for doing this for the script, was to avoid deserialization from the filesystem (performance and dealing with file paths). It is actually supported to load the script from a file instead through (sendCustomScriptFile), but some small code changes would be needed to make it part of the 'protocol' eg. re-upload functionality. But I completely agree with you, it is fairly annoying that you have to rerun cmake + compilation to evaluate a small change in the script, and the performance is essentially irrelevant during initialization.
Regarding the recipes I just wanted it to be fast (read from memory) and I did not have a lot of recipes in the beginning. Since there is now a lot of recipes and a potential need for custom recipes also, I will make it file based instead (XML or YAML likely) which is also a lot nicer and something that has been on my TODO almost since I initially implemented the library.
Yes I actually haven't done much optimization in terms compilation speed, I believe some classes can be forward declared and I will take a look at the linking in general.
Thanks for the feedback, it is very valuable.
I never tried to communicate with gripper URCAP server from outside but it sounds like a good idea.
I will try it !
https://assets.robotiq.com/website-assets/support_documents/document/Hand-E_Manual_UniversalRobots_PDF_20191219.pdf
And testing with https://sourceforge.net/projects/sockettest/ was trivial. Set IP address and port, connect, and write "GET POS" or "SET POS 255".
Thank you for sharing this. I will try it !
Thanks a lot for posting your script. I made this ROS node based on it, and it seems to work well from what I can tell. It is a lot more convenient than sending URScripts, for sure.
If you add a permissive license (ideally BSD, MIT or public domain) I will be happy to apply the same and release the code in a package.
I am not sure which script you are referring to, since the gripper_2f85.py file does not have a variable `gripper_socket`.
Unfortunately I do not have access to the URCaps code anymore, so I'm not sure what it does to access a second gripper. I remember that it exposes port `63352`, so perhaps `63353` is the next gripper, and you would connect with: gripper.connect('10.0.1.5', 63353) ?
Sorry I can't be of more help. I don't have access anymore.
Feel free to contact me.