Skip to content

Commit

Permalink
release v2.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
anla-xu committed Sep 13, 2022
1 parent 33992ba commit 8f58e0c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 32 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion pymycobot/Interface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# coding=utf-8
from re import I
from pymycobot.common import ProtocolCode
from pymycobot.generate import MyCobotCommandGenerator

Expand Down
2 changes: 1 addition & 1 deletion pymycobot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"Mira"
]

__version__ = "2.9.5"
__version__ = "2.9.6"
__author__ = "Elephantrobotics"
__email__ = "[email protected]"
__git_url__ = "https://github.com/elephantrobotics/pymycobot"
Expand Down
43 changes: 14 additions & 29 deletions pymycobot/mybuddysocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8f58e0c

Please sign in to comment.