Skip to content

Commit 473dac7

Browse files
author
Leonid Fedorenchik
committed
mycobotpro630: Add electric gripper support
1 parent f0f6121 commit 473dac7

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

pymycobot/mycobotpro630.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,7 +2781,27 @@ def tool_set_gripper_mode(self, mode):
27812781
"""
27822782
self._send_can([0x02, 0x6D, mode])
27832783

2784+
def tool_set_gripper_electric_init(self):
2785+
"""Inits Electric Gripper. Need to call it before other electric gripper operation."""
2786+
self._send_can([0x01, 0x6C])
2787+
2788+
def tool_set_gripper_electric_open(self):
2789+
"""Opens Electric Gripper."""
2790+
self._send_can([0x02, 0x6A, 0x00])
2791+
2792+
def tool_set_gripper_electric_close(self):
2793+
"""Closes Electric Gripper."""
2794+
self._send_can([0x02, 0x6A, 0x01])
2795+
27842796
def tool_gripper_pro_set_angle(self, angle):
2797+
"""Sets current angle of Pro Gripper.
2798+
2799+
Args:
2800+
angle (int): angle to set
2801+
2802+
Returns:
2803+
bool: True if success, False otherwise
2804+
"""
27852805
if angle < 0 or angle > 100:
27862806
return False
27872807
command = [254, 254, 8, 14, 6, 0, 11, 0, angle]
@@ -2792,6 +2812,11 @@ def tool_gripper_pro_set_angle(self, angle):
27922812
return bool(ret[8])
27932813

27942814
def tool_gripper_pro_get_angle(self):
2815+
"""Returns current angle of Pro Gripper.
2816+
2817+
Returns:
2818+
int: current angle
2819+
"""
27952820
command = [254, 254, 8, 14, 3, 0, 12, 0, 0]
27962821
crc16_value = crc.Calculator(crc.Crc16.MODBUS.value).checksum(bytes(command))
27972822
command.extend([(crc16_value >> 8), (crc16_value & 0xFF)])
@@ -2800,12 +2825,30 @@ def tool_gripper_pro_get_angle(self):
28002825
return int((ret[7] << 8) | (ret[8]))
28012826

28022827
def tool_gripper_pro_open(self):
2828+
"""Fully opens Pro Gripper.
2829+
2830+
Returns:
2831+
bool: True if success, False otherwise.
2832+
"""
28032833
return self.tool_gripper_pro_set_angle(100)
28042834

28052835
def tool_gripper_pro_close(self):
2836+
"""Fully closes Pro Gripper.
2837+
2838+
Returns:
2839+
bool: True if success, False otherwise.
2840+
"""
28062841
return self.tool_gripper_pro_set_angle(0)
28072842

28082843
def tool_gripper_pro_set_torque(self, torque_value):
2844+
"""Sets torque of Pro Gripper.
2845+
2846+
Args:
2847+
torque_value (int): torque value between 100 and 300
2848+
2849+
Returns:
2850+
bool: True if success, False otherwise
2851+
"""
28092852
if torque_value < 100 or torque_value > 300:
28102853
return False
28112854
command = [
@@ -2826,6 +2869,11 @@ def tool_gripper_pro_set_torque(self, torque_value):
28262869
return bool(ret[8])
28272870

28282871
def tool_gripper_pro_get_torque(self):
2872+
"""Returns current torque value of Pro Gripper.
2873+
2874+
Returns:
2875+
int: current torque value
2876+
"""
28292877
command = [254, 254, 8, 14, 3, 0, 28, 0, 0]
28302878
crc16_value = crc.Calculator(crc.Crc16.MODBUS.value).checksum(bytes(command))
28312879
command.extend([(crc16_value >> 8), (crc16_value & 0xFF)])

0 commit comments

Comments
 (0)