Another related post: https://dof.robotiq.com/discussion/92/controlling-the-robotiq-2-finger-gripper-with-modbus-commands-in-python?_ga=2.17431289.1133307955.1542044765-1547192274.1535646624
@Ruben_Speybrouck
It is challenging.
The best reference for this is sdurobotics: https://sdurobotics.gitlab.io/ur_rtde/api/api.html#robotiq-gripper-api
I never tried it but I think that if the system communicate with the gripper via RTDE it should work even if the gripper is mounted on the camera.
This article is to control a gripper directly connected to a PC. In you case the gripper is connected to the camera and the camera is connected to the controller so it cannot work.
@Ruben_Speybrouck
This method is described in this article:
https://dof.robotiq.com/discussion/1987/how-to-control-robotiq-product-through-port-30002-on-universal-robot#latest
The gripper is controlled by sending UR script to UR interface. It is easy, it works but it is a bit slow because there is a lot of code to send for one action.
Thank you for the quick response!
All files are included in this google drive folder here
I have a 2F-85 connected to my laptop via the USB to RS-485 adapter and Robotiq cable included with the gripper. After installing drivers for the adapter, the device appears on 'COM5'
Opening the Robotiq User Interface I see it has been recognized by the software and verify that it is on 'COM5' and has the default parameters (baud rate = 115200, stop bit = 1, no parity bit, slave ID = 9, and having terminal resister checked).
Downloading your code (which appears to be an excellent and useful tool), I change the port name in the test section (line 545) to 'COM5' and run the code. Here is the output:
Afterward, I was able to get the code from https://dof.robotiq.com/discussion/92/controlling-the-robotiq-2-finger-gripper-with-modbus-commands-in-python running. Modifying the code slightly I have separated the close and open commands and have put them in callable functions.
Ideally, I would get your code running as it seems extremely useful and flexible in using the entirety of the gripper's functionality.
Thank you again for your help,
Nick
@bcastets
Do you have some sample code for this? I am inexperienced using the minimal modbus library
@NickAarsvold
Minimal modbus is well documented:
https://minimalmodbus.readthedocs.io/en/stable/
You should be able to make it.
Here below is an example of what you could try:
instrument = minimalmodbus.Instrument('COM5', 9, debug = True)
instrument.write_registers(1000,[256,0,0]) #Activate the gripper
That code was able to activate the gripper. I am not sure why the rest of the code doesn't work.
@bcastets I am now able to get the gripper working, thank you so much for your help. In this google drive folder is the code I got working.
Running the mmtest script, I am able to call functions from the robotiqGripper script. The original mmtest program which is mostly commented out worked flawlessly. Interestingly, I was able to call the robotiqGripper functions after running the program you have listed above. I then commented out line by line until I found the line of code that would break the program when absent. For whatever reason, when commenting out the line:
instrument.serial.baudrate = 115200
the gripper is unable to run in the robotiqGripper script called.
I am not sure why this is considering line 19 of robotiqGripper.py should do the same thing as instrument.serial.baudrate=115200
Nevertheless, thank you for your support,
Nick
I share with you a python program I did to control Robotiq grippers from a PC using Python and MODBUS RTU protocol.
The code is hosted on github:
https://github.com/castetsb/pyRobotiqGripper
I did this program after receiving several questions about how to connect our gripper on different robots, PC,... If you want to make such prooject, I recommend that you check the user manual (https://robotiq.com/support/2f-85-2f-140/downloads-instruction-manual-cb-series?document=). Everything is explain in details with examples.
Robotiq grippers are using MODBUS RTU protocol and can be control just by writing command in their registers. I used minimalMobus library to write in gripper register and request actions.
I hope this will help to understand how its working.