From 8f58e0cd9cfd6e27079722e7f521fb5f274c4b80 Mon Sep 17 00:00:00 2001 From: weiquan Date: Tue, 13 Sep 2022 17:01:42 +0800 Subject: [PATCH] release v2.9.6 --- CHANGELOG.md | 7 ++++++- pymycobot/Interface.py | 1 - pymycobot/__init__.py | 2 +- pymycobot/mybuddysocket.py | 43 +++++++++++++------------------------- 4 files changed, 21 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f32892..5aa7a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # ChangeLog for pymycobot -## v2.9.5(2022-9-13) +## v2.9.6 (2022-9-13) + +- release v2.9.6 +- Fix MyBuddySocket get_radians()、send_radians() BUG + +## v2.9.5 (2022-9-13) - release v2.9.5 - Add MyBuddy serial open(),is_open() function diff --git a/pymycobot/Interface.py b/pymycobot/Interface.py index 9565e2e..270c971 100644 --- a/pymycobot/Interface.py +++ b/pymycobot/Interface.py @@ -1,5 +1,4 @@ # coding=utf-8 -from re import I from pymycobot.common import ProtocolCode from pymycobot.generate import MyCobotCommandGenerator diff --git a/pymycobot/__init__.py b/pymycobot/__init__.py index e593895..b63df8b 100644 --- a/pymycobot/__init__.py +++ b/pymycobot/__init__.py @@ -30,7 +30,7 @@ "Mira" ] -__version__ = "2.9.5" +__version__ = "2.9.6" __author__ = "Elephantrobotics" __email__ = "weiquan.xu@elephantrobotics.com" __git_url__ = "https://github.com/elephantrobotics/pymycobot" diff --git a/pymycobot/mybuddysocket.py b/pymycobot/mybuddysocket.py index ac339b0..ca4bf7a 100644 --- a/pymycobot/mybuddysocket.py +++ b/pymycobot/mybuddysocket.py @@ -138,45 +138,30 @@ def _mesg(self, genre, *args, **kwargs): return res return None - def get_radians(self): - """Get all angle return a list + def get_radians(self, id): + """Get the radians of all joints + Args: + id: 1/2 (L/R) + Return: - data_list (list[radian...]): + list: A list of float radians [radian1, ...] """ - angles = self._mesg(ProtocolCode.GET_ANGLES, has_reply=True) + angles = self._mesg(ProtocolCode.GET_ANGLES, id, has_reply=True) return [round(angle * (math.pi / 180), 3) for angle in angles] - def send_radians(self, radians, speed): - """Send all angles + def send_radians(self, id, radians, speed): + """Send the radians of all joints to robot arm Args: - radians (list): example [0, 0, 0, 0, 0, 0] - speed (int): 0 ~ 100 + id: 1/2 (L/R). + radians: a list of radian values( List[float]), length 6 + speed: (int )0 ~ 100 """ - calibration_parameters(len6=radians, speed=speed) + # calibration_parameters(len6=radians, speed=speed) degrees = [self._angle2int(radian * (180 / math.pi)) for radian in radians] - return self._mesg(ProtocolCode.SEND_ANGLES, degrees, speed) - - def sync_send_angles(self, degrees, speed, timeout=7): - t = time.time() - self.send_angles(degrees, speed) - while time.time() - t < timeout: - f = self.is_in_position(degrees, 0) - if f: - break - time.sleep(0.1) - return self - - def sync_send_coords(self, coords, speed, mode, timeout=7): - t = time.time() - self.send_coords(coords, speed, mode) - while time.time() - t < timeout: - if self.is_in_position(coords, 1): - break - time.sleep(0.1) - return self + return self._mesg(ProtocolCode.SEND_ANGLES, id, degrees, speed) def set_gpio_mode(self, mode): """Set pin coding method