castetsb / pyRobotiqGripper

Library to control Robotiq company grippers from python
MIT License
30 stars 11 forks source link

[Hand E Gripper]: No communication with the instrument #2

Closed shobhitagg closed 3 months ago

shobhitagg commented 4 months ago

Thanks for a simple implementation of the Modbus script. Such a script would be ideal for my project.

But unfortunately, I am unable to connect to the gripper when I run the script. The gripper remains in the red LED state. I tried using it with macOS, Ubuntu 20.04, and Ubuntu 22.04, and get the same terminal output. When I use Robotiq User Interface, I can control the gripper.

Model: Hand-E gripper Terminal Output:

{'gOBJ': {}, 'gSTA': {}, 'gGTO': {}, 'gACT': {}, 'kFLT': {}, 'gFLT': {}, 'gPR': {}, 'gPO': {}, 'gCU': {}}
MinimalModbus debug mode. Will write to instrument (expecting 11 bytes back): 09 03 07 D0 00 03 04 0E (8 bytes)
MinimalModbus debug mode. Clearing serial buffers for port /dev/ttyUSB1
MinimalModbus debug mode. No sleep required before write. Time since previous read: 872287877.63 ms, minimum silent period: 2.01 ms.
MinimalModbus debug mode. Response from instrument:  (0 bytes), roundtrip time: 0.1 ms. Timeout for reading: 50.0 ms.

Traceback (most recent call last):
  File "robotiqGripper.py", line 552, in <module>
    grip=RobotiqGripper("/dev/ttyUSB1")
  File "robotiqGripper.py", line 75, in __init__
    self.readAll()
  File "robotiqGripper.py", line 225, in readAll
    registers=self.read_registers(2000,3)#Changed from 6 to 3 register reading. This modification has not been tested.
  File "/home/mfi/repo/pyRobotiqGripper/venv/lib/python3.8/site-packages/minimalmodbus.py", line 927, in read_registers
    returnvalue = self._generic_command(
  File "/home/mfi/repo/pyRobotiqGripper/venv/lib/python3.8/site-packages/minimalmodbus.py", line 1276, in _generic_command
    payload_from_slave = self._perform_command(functioncode, payload_to_slave)
  File "/home/mfi/repo/pyRobotiqGripper/venv/lib/python3.8/site-packages/minimalmodbus.py", line 1353, in _perform_command
    response_bytes = self._communicate(request_bytes, number_of_bytes_to_read)
  File "/home/mfi/repo/pyRobotiqGripper/venv/lib/python3.8/site-packages/minimalmodbus.py", line 1521, in _communicate
    raise NoResponseError("No communication with the instrument (no answer)")
minimalmodbus.NoResponseError: No communication with the instrument (no answer)
castetsb commented 3 months ago

Thank you for your feedback. The python simple modbus library changed and my code was outdated. I updated the main branch. It should be ok now.

castetsb commented 3 months ago

I close this issue