diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a2da0f..3af3a43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # ChangeLog for pymycobot +## v3.0.0 (2022-12-9) + +- release v3.0.0 +- Fix MyBuddy interface problems: get_base_coords()、set_gripper_state() +- Add 7-axis myArm interface + ## v2.9.9 (2022-11-29) - release 2.9.9 diff --git a/pymycobot/Interface.py b/pymycobot/Interface.py index 163711e..42496d3 100644 --- a/pymycobot/Interface.py +++ b/pymycobot/Interface.py @@ -716,14 +716,15 @@ def get_gripper_value(self, id): """ return self._mesg(ProtocolCode.GET_GRIPPER_VALUE, id, has_reply=True) - def set_gripper_state(self, id, flag): + def set_gripper_state(self, id, flag, sp): """Set gripper switch state Args: id: 1/2 (L/R) - flag (int): 0 - close, 1 - open + flag (int): 0 - open, 1 - close + sp: int (1 - 100) """ - return self._mesg(ProtocolCode.SET_GRIPPER_STATE, id, flag) + return self._mesg(ProtocolCode.SET_GRIPPER_STATE, id, flag, sp) def set_gripper_value(self, id, value, speed): """Set gripper value diff --git a/pymycobot/__init__.py b/pymycobot/__init__.py index 3308893..88f79a3 100644 --- a/pymycobot/__init__.py +++ b/pymycobot/__init__.py @@ -43,7 +43,7 @@ from pymycobot.mybuddyemoticon import MyBuddyEmoticon __all__.append("MyBuddyEmoticon") -__version__ = "3.0.0b2" +__version__ = "3.0.0" __author__ = "Elephantrobotics" __email__ = "weiquan.xu@elephantrobotics.com" __git_url__ = "https://github.com/elephantrobotics/pymycobot" diff --git a/pymycobot/generate.py b/pymycobot/generate.py index f95c9d5..c539cd2 100644 --- a/pymycobot/generate.py +++ b/pymycobot/generate.py @@ -175,6 +175,7 @@ def is_power_on(self): return self._mesg(ProtocolCode.IS_POWER_ON, has_reply=True) def release_all_servos(self): + """Relax all joints""" return self._mesg(ProtocolCode.RELEASE_ALL_SERVOS) def is_controller_connected(self): @@ -653,10 +654,8 @@ def get_digital_input(self, pin_no): """singal value""" return self._mesg(ProtocolCode.GET_DIGITAL_INPUT, pin_no, has_reply=True) - """ - def set_pwm_mode(self, pin_no, channel): - self._mesg(Command.SET_PWM_MODE, pin_no, channel) - """ + def set_pwm_mode(self, mode): + return self._mesg(ProtocolCode.SET_PWM_MODE, mode) def set_pwm_output(self, channel, frequency, pin_val): """ PWM control diff --git a/pymycobot/myarm.py b/pymycobot/myarm.py index 7714ece..864ce85 100644 --- a/pymycobot/myarm.py +++ b/pymycobot/myarm.py @@ -111,7 +111,8 @@ def _mesg(self, genre, *args, **kwargs): ProtocolCode.GET_JOINT_MIN_ANGLE, ProtocolCode.GET_JOINT_MAX_ANGLE, ProtocolCode.GET_FRESH_MODE, - ProtocolCode.GET_GRIPPER_MODE + ProtocolCode.GET_GRIPPER_MODE, + ProtocolCode.SET_SSID_PWD ]: return self._process_single(res) elif genre in [ProtocolCode.GET_ANGLES]: @@ -222,3 +223,31 @@ def set_solution_angles(self, angle, speed): def get_solution_angles(self): """Get zero space deflection angle value""" return self._mesg(ProtocolCode.GET_SOLUTION_ANGLES, has_reply=True) + + def release_all_servos(self, data): + """Relax all joints + + Args: + data: 1 - Undamping (The default is damping) + """ + return self._mesg(ProtocolCode.RELEASE_ALL_SERVOS, data) + + def get_transpoendr_mode(self): + """Obtain the configuration information of serial transmission mode + + Return: + mode: 0 - 1 - 2 + """ + return self._mesg(ProtocolCode.SET_SSID_PWD, has_reply=True) + + def set_transpoendr_mode(self, mode): + """Set serial port transmission mode + + Args: + mode: + 0 - Turn off transparent transmission.\n + 1 - Turn on transparent transmission. verify all data.\n + 2 - Turn on transparent transmission, only verify the configuration information of communication forwarding mode (default is 0) + """ + return self._mesg(ProtocolCode.GET_SSID_PWD, mode) + \ No newline at end of file diff --git a/pymycobot/mybuddy.py b/pymycobot/mybuddy.py index 598319f..3061fe8 100644 --- a/pymycobot/mybuddy.py +++ b/pymycobot/mybuddy.py @@ -168,7 +168,7 @@ def _mesg(self, genre, *args, **kwargs): return self._int2coord(res[0]) if res else None else: return self._int2angle(res[0]) if res else None - elif genre in [ProtocolCode.GET_COORDS, ProtocolCode.GET_TOOL_REFERENCE, ProtocolCode.GET_WORLD_REFERENCE, ProtocolCode.GET_BASE_COORDS, ProtocolCode.GET_BASE_COORD, ProtocolCode.BASE_TO_SINGLE_COORDS]: + elif genre in [ProtocolCode.GET_ALL_BASE_COORDS, ProtocolCode.GET_COORDS, ProtocolCode.GET_TOOL_REFERENCE, ProtocolCode.GET_WORLD_REFERENCE, ProtocolCode.GET_BASE_COORDS, ProtocolCode.GET_BASE_COORD, ProtocolCode.BASE_TO_SINGLE_COORDS]: if res: r = [] for idx in range(3):