Home Programming

Discussion

Left ArrowBack to discussions page
bcastetsbcastets Vacuum Beta tester Posts: 322 Handy
edited October 2020 in Programming
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.



Comments

  • nicolasmarcstephannicolasmarcstephan Posts: 4 Apprentice
    Thank you for referring me here @bcastets !

    You were right, this was exactly what I was looking for.
    But unfortunately also this code doesn't work for me. MinimalModbus is installed and I checked the Robotiq User Interface where it shows me that the port is COM6 and the slave number is 9. The gripper is sitting on a Robotiq wrist camera. Could this be the problem?

    This is the error message:

    MinimalModbus debug mode. Will write to instrument (expecting 17 bytes back): '\t\x03\x07Ð\x00\x06Ä\r' (09 03 07 D0 00 06 C4 0D)
    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)
    MinimalModbus debug mode. Response from instrument: '' () (0 bytes), roundtrip time: 47.0 ms. Timeout for reading: 50.0 ms.

    Process finished with exit code 1


    Thank you so much for your help!







  • bcastetsbcastets Vacuum Beta tester Posts: 322 Handy
    edited February 18
    @nicolasmarcstephan
    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.
  • nicolasmarcstephannicolasmarcstephan Posts: 4 Apprentice
    edited February 18
    Thank you for your answer.

    Is there an API for the wrist camera?
    Otherwise I will just use the gripper coupling.
  • bcastetsbcastets Vacuum Beta tester Posts: 322 Handy
    @nicolasmarcstephan
    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.
Sign In or Register to comment.
Left ArrowBack to discussions page