luismesas / pydobot

Python library for Dobot Magician
MIT License
110 stars 59 forks source link

Function for Gripper #5

Closed LegendaryRifle closed 5 years ago

LegendaryRifle commented 6 years ago

Hi, I can't seem to figure out the code for activating/deactivating the gripper. Here's the code that I've done so far:

def _set_end_effector_gripper(self, grip=False):
    msg = Message()
    msg.id = 63
    msg.ctrl = 0x03
    msg.params = bytearray([])
    msg.params.extend(bytearray([0x01]))
    if grip is True:
        msg.params.extend(bytearray([0x01]))
    else:
        msg.params.extend(bytearray([0x00]))
    return self._send_command(msg)

def grip(self, grip):
    self._set_end_effector_gripper(grip)
luismesas commented 5 years ago

can you try with latest version of the library? I have added your code and it works correctly.