Home› Programming
Discussion
Back to discussions page
bcastets
Vacuum Beta tester Posts: 322 Handy
Control grippers from Python using MODBUS RTU |
1.2K views
|
Answered | |
/ Most recent by bcastets
in Programming
|
5 comments |

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.
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.
Support Tech
+01 418-380-2788 ext. 236
[email protected]
MinimalModbus debug mode. Clearing serial buffers for port COM6
MinimalModbus debug mode. No sleep required before write. Time since previous read: 7298031.00 ms, minimum silent period: 2.01 ms.
Traceback (most recent call last):
File "...\pyRobotiqGripper-master\robotiqGripper.py", line 554, in <module>
grip = RobotiqGripper("COM6") # /dev/ttyUSB1
File "...\pyRobotiqGripper-master\robotiqGripper.py", line 76, in __init__
self.readAll()
File "...\pyRobotiqGripper-master\robotiqGripper.py", line 235, in readAll
registers = self.read_registers(2000, 6)
File "...\pyRobotiqGripper-master\venv\lib\site-packages\minimalmodbus.py", line 844, in read_registers
return self._generic_command(
File "...\pyRobotiqGripper-master\venv\lib\site-packages\minimalmodbus.py", line 1170, in _generic_command
payload_from_slave = self._perform_command(functioncode, payload_to_slave)
File "...\pyRobotiqGripper-master\venv\lib\site-packages\minimalmodbus.py", line 1240, in _perform_command
response = self._communicate(request, number_of_bytes_to_read)
File "...\pyRobotiqGripper-master\venv\lib\site-packages\minimalmodbus.py", line 1406, in _communicate
raise NoResponseError("No communication with the instrument (no answer)")
minimalmodbus.NoResponseError: No communication with the instrument (no answer)
It is a bit complex to control the gripper through the wrist camera. I would recommend to separate the connection.
You can mount a gripper coupling on top of the camera to separate communication.
Unfortunately we don't have API our documentation to make advance control of the camera and connected components.
The camera is made to be use in combinaison of UR robot and controlled via its URCAP on polyscope.