From 02a11c0054697f66f34440d43b7dba8d2b21c3e2 Mon Sep 17 00:00:00 2001 From: weiquan Date: Thu, 6 Jul 2023 11:12:46 +0800 Subject: [PATCH] release v3.1.5 --- CHANGELOG.md | 5 +++++ docs/README.md | 23 +++++++++++++++++++++++ pymycobot/__init__.py | 2 +- pymycobot/common.py | 2 ++ pymycobot/generate.py | 13 +++++++++++++ pymycobot/mycobot.py | 2 ++ pymycobot/mypalletizer.py | 2 ++ 7 files changed, 48 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf74556..bcd724d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ChangeLog for pymycobot +## v3.1.5 (2023-07-06) + +- release v3.1.5 +- Add mycobot interface:get_basic_version(),set_communicate_mode() + ## v3.1.4 (2023-07-05) - release v3.1.4 diff --git a/docs/README.md b/docs/README.md index 1074a39..c021e91 100644 --- a/docs/README.md +++ b/docs/README.md @@ -96,6 +96,8 @@ We support Python2, Python3.5 or later. - [set\_plan\_speed](#set_plan_speed) - [set\_plan\_acceleration](#set_plan_acceleration) - [set\_gservo\_round](#set_gservo_round) + - [get\_basic\_version](#get_basic_version) + - [set\_communicate\_mode](#set_communicate_mode) - [get\_servo\_speeds](#get_servo_speeds) - [get\_servo\_currents](#get_servo_currents) - [get\_servo\_voltages](#get_servo_voltages) @@ -1115,6 +1117,27 @@ Set the terminal atom io status 255 : Keep turning 1 ~ 254: Based on 30° (1->30°, 2->60°) +### get_basic_version + +- **Prototype**: `get_basic_version()` + +- **Description**: Get basic firmware version. + +- **Return** + + - `version` (`float`) + +### set_communicate_mode + +- **Prototype**: `set_communicate_mode(mode)` + +- **Description**: Set basic communication mode. + +- **Parameters** + + - `mode` (`int`) 0 - Turn off transparent transmission. 1 - Open transparent transmission + + ### get_servo_speeds - **Prototype**: `get_servo_speeds()` diff --git a/pymycobot/__init__.py b/pymycobot/__init__.py index b69b587..ad2c3d3 100644 --- a/pymycobot/__init__.py +++ b/pymycobot/__init__.py @@ -44,7 +44,7 @@ from pymycobot.mybuddyemoticon import MyBuddyEmoticon __all__.append("MyBuddyEmoticon") -__version__ = "3.1.4" +__version__ = "3.1.5" __author__ = "Elephantrobotics" __email__ = "weiquan.xu@elephantrobotics.com" __git_url__ = "https://github.com/elephantrobotics/pymycobot" diff --git a/pymycobot/common.py b/pymycobot/common.py index eaa441d..e2548e2 100644 --- a/pymycobot/common.py +++ b/pymycobot/common.py @@ -121,6 +121,8 @@ class ProtocolCode(object): # Get the measured distance GET_TOF_DISTANCE = 0xC0 + GET_BASIC_VERSION = 0xC1 + SET_COMMUNICATE_MODE = 0xC2 # Coordinate transformation SET_TOOL_REFERENCE = 0x81 diff --git a/pymycobot/generate.py b/pymycobot/generate.py index 5cb2c42..595ed29 100644 --- a/pymycobot/generate.py +++ b/pymycobot/generate.py @@ -1041,3 +1041,16 @@ def set_gservo_round(self, angle): 1 ~ 254: Based on 30° (1->30°, 2->60°) """ return self._mesg(ProtocolCode.SET_GSERVO_ROUND, angle) + + + def get_basic_version(self): + """Get basic firmware version""" + return self._mesg(ProtocolCode.GET_BASIC_VERSION, has_reply = True) + + def set_communicate_mode(self, mode): + """Set basic communication mode + + Args: + mode: 0 - Turn off transparent transmission,1 - Open transparent transmission + """ + return self._mesg(ProtocolCode.SET_COMMUNICATE_MODE, mode) \ No newline at end of file diff --git a/pymycobot/mycobot.py b/pymycobot/mycobot.py index 3c0aeb3..1244fa3 100755 --- a/pymycobot/mycobot.py +++ b/pymycobot/mycobot.py @@ -129,6 +129,8 @@ def _mesg(self, genre, *args, **kwargs): return [self._int2coord(angle) for angle in res] elif genre in [ProtocolCode.GET_JOINT_MAX_ANGLE, ProtocolCode.GET_JOINT_MIN_ANGLE]: return self._int2coord(res[0]) + elif genre in [ProtocolCode.GET_BASIC_VERSION, ProtocolCode.SOFTWARE_VERSION]: + return self._int2coord(self._process_single(res)) else: return res return None diff --git a/pymycobot/mypalletizer.py b/pymycobot/mypalletizer.py index d263bb4..f6c1179 100644 --- a/pymycobot/mypalletizer.py +++ b/pymycobot/mypalletizer.py @@ -163,6 +163,8 @@ def _mesg(self, genre, *args, **kwargs): ProtocolCode.GET_JOINT_MAX_ANGLE, ]: return self._int2angle(res[0]) if res else 0 + elif genre in [ProtocolCode.GET_BASIC_VERSION, ProtocolCode.SOFTWARE_VERSION]: + return self._int2coord(self._process_single(res)) else: return res return None