diff --git a/cpp/sdk b/cpp/sdk index c1b5bd1..8444338 160000 --- a/cpp/sdk +++ b/cpp/sdk @@ -1 +1 @@ -Subproject commit c1b5bd1253974fc896b1aaa8e62a9c578de718b5 +Subproject commit 84443388830e4267ac0cfe699caddf677185812e diff --git a/dexhand/dexhand.py b/dexhand/dexhand.py index 493cc35..c3636d3 100644 --- a/dexhand/dexhand.py +++ b/dexhand/dexhand.py @@ -49,7 +49,7 @@ def __init__(self, adapter_type=AdapterType.ZLG_200U, adapter_index=0): LibDexHand.get_device_id_021s.restype = c_ubyte LibDexHand.get_firmware_version_021s.argtypes = [c_void_p, c_ubyte] - LibDexHand.get_firmware_version_021s.restype = c_ubyte + LibDexHand.get_firmware_version_021s.restype = c_uint16 LibDexHand.enable_realtime_response_021s.argtypes = [c_void_p, c_ubyte, c_bool] @@ -66,7 +66,10 @@ def __init__(self, adapter_type=AdapterType.ZLG_200U, adapter_index=0): LibDexHand.move_finger_021s.argtypes = [c_void_p, c_ubyte, c_short, c_short, c_ubyte, c_uint, c_ubyte] LibDexHand.reset_joints_021s.argtypes = [c_void_p, c_ubyte] - LibDexHand.clear_error_021s.argtypes = [c_void_p, c_ubyte, c_ubyte] + LibDexHand.clear_error_021s.argtypes = [c_void_p, c_ubyte] + + LibDexHand.get_error_code_021s.argtypes = [c_void_p, c_ubyte, c_ubyte] + LibDexHand.get_error_code_021s.restype = c_ubyte LibDexHand.get_motor_current_021s.argtypes = [c_void_p, c_ubyte, c_ubyte] LibDexHand.get_motor_current_021s.restype = c_short @@ -138,10 +141,10 @@ def reset_joints(self, device_id): LibDexHand.reset_joints_021s(self.instance, device_id) def get_error_code(self, device_id, finger_id): - LibDexHand.get_error_code_021s(self.instance, finger_id, device_id) + return LibDexHand.get_error_code_021s(self.instance, finger_id, device_id) - def clear_error(self, device_id, finger_id): - LibDexHand.clear_error_021s(self.instance, finger_id, device_id) + def clear_error(self, device_id): + LibDexHand.clear_error_021s(self.instance, device_id) def get_motor_current(self, device_id, finger_id): return LibDexHand.get_motor_current_021s(self.instance, finger_id, device_id) diff --git a/examples/DX021S_example.py b/examples/DX021S_example.py index 2ed1294..c97f837 100644 --- a/examples/DX021S_example.py +++ b/examples/DX021S_example.py @@ -6,7 +6,7 @@ def main(): - hand021s = DexHand021S(adapter_type=AdapterType.ZLG_200U, adapter_index=0) + hand021s = DexHand021S(adapter_type=AdapterType.ZLG_MINI, adapter_index=0) hand021s.listen(enable=True) device_id = hand021s.get_device_id(channel=0) # device_id = 0x01 @@ -20,10 +20,7 @@ def main(): maxCurrent1 = hand021s.get_safe_current(device_id=device_id, finger_id=0x01) print('Maximum allowed Current of finger 1 is {}'.format(maxCurrent1)) - hand021s.clear_error(device_id, 0x01) - hand021s.clear_error(device_id, 0x02) - hand021s.clear_error(device_id, 0x03) - hand021s.clear_error(device_id, 0x04) + hand021s.clear_error(device_id) hand021s.reset_joints(device_id) time.sleep(1) @@ -39,9 +36,7 @@ def main(): print('joint1={}, joint2={}, joint3={}'.format(joint1, joint2, joint3)) - hand021s.clear_error(device_id, 0x01) - hand021s.clear_error(device_id, 0x02) - hand021s.clear_error(device_id, 0x03) + hand021s.clear_error(device_id) time.sleep(0.8) @@ -49,9 +44,7 @@ def main(): hand021s.move_finger(device_id, 0x02, 0, 500, 0x55, 10) hand021s.move_finger(device_id, 0x03, 0, 500, 0x55, 10) - hand021s.clear_error(device_id, 0x01) - hand021s.clear_error(device_id, 0x02) - hand021s.clear_error(device_id, 0x03) + hand021s.clear_error(device_id) time.sleep(0.8)