Skip to content

Commit

Permalink
release v3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
anla-xu committed Dec 20, 2022
1 parent 7cd0502 commit 9f90213
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ChangeLog for pymycobot

## v3.0.2 (2022-12-20)

- release v3.0.2
- Fix MyBuddy interface problems:
- Add get_fresh_mode()
- remove get_servo_current()
- get_servo_voltages()、get_servo_status()、get_servo_temps()

## v3.0.1 (2022-12-9)

- release v3.0.1
Expand Down
31 changes: 19 additions & 12 deletions pymycobot/Interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ def set_fresh_mode(self, id, mode):
0 - Execute instructions sequentially in the form of a queue.
"""
return self._mesg(ProtocolCode.SET_FRESH_MODE, id, mode)

def get_fresh_mode(self, id):
"""Get instruction refresh mode status
Args:
id: 1/2 (L/R).
"""
return self._mesg(ProtocolCode.GET_FRESH_MODE, id, has_reply=True)

def set_free_mode(self, id, value):
"""set free mode
Expand Down Expand Up @@ -939,27 +947,26 @@ def set_plan_acceleration(self, id, acceleration):
ProtocolCode.SET_PLAN_ACCELERATION, id, acceleration
)

def get_servo_currents(self, id):
"""Get joint current
# def get_servo_currents(self, id):
# """Get joint current

Args:
id: 1/2/3 (L/R/W)
# Args:
# id: 1/2/3 (L/R/W)

Return:
value mA
"""
return self._mesg(ProtocolCode.GET_SERVO_VOLTAGES, id, has_reply=True)
# Return:
# value mA
# """
# return self._mesg(ProtocolCode.GET_SERVO_CURRENTS, id, has_reply=True)

def get_servo_voltages(self, id):
"""Get joint voltages
Args:
id: 1/2/3 (L/R/W)
Return:
volts < 24 V
"""
return self._mesg(ProtocolCode.GET_SERVO_STATUS, id, has_reply=True)
return self._mesg(ProtocolCode.GET_SERVO_VOLTAGES, id, has_reply=True)

def get_servo_status(self, id):
"""Get joint status
Expand All @@ -970,15 +977,15 @@ def get_servo_status(self, id):
Return:
[voltage, sensor, temperature, current, angle, overload], a value of 0 means no error
"""
return self._mesg(ProtocolCode.GET_SERVO_TEMPS, id, has_reply=True)
return self._mesg(ProtocolCode.GET_SERVO_STATUS, id, has_reply=True)

def get_servo_temps(self, id):
"""Get joint temperature
Args:
id: 1/2/3 (L/R/W)
"""
return self._mesg(0xE6, id, has_reply=True)
return self._mesg(ProtocolCode.GET_SERVO_TEMPS, id, has_reply=True)

def get_base_coords(self, *args):
"""Convert coordinates to base coordinates. Pass in parameters or no parameters
Expand Down
2 changes: 1 addition & 1 deletion pymycobot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from pymycobot.mybuddyemoticon import MyBuddyEmoticon
__all__.append("MyBuddyEmoticon")

__version__ = "3.0.1"
__version__ = "3.0.2"
__author__ = "Elephantrobotics"
__email__ = "[email protected]"
__git_url__ = "https://github.com/elephantrobotics/pymycobot"
Expand Down
4 changes: 4 additions & 0 deletions pymycobot/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ def _process_received(self, data, genre, arm=6):

# process valid data
res = []
if genre in [ProtocolCode.GET_SERVO_VOLTAGES, ProtocolCode.GET_SERVO_STATUS, ProtocolCode.GET_SERVO_TEMPS]:
for i in valid_data:
res.append(i)
return res
if data_len in [6, 8, 12, 14, 24, 60]:
for header_i in range(0, len(valid_data), 2):
one = valid_data[header_i : header_i + 2]
Expand Down
8 changes: 7 additions & 1 deletion pymycobot/mybuddy.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ def _read(self):
datas = b'\xfe'
pre = k
except:
self.log.debug("_read: {}".format(datas))

datas = None
break
else:
self.log.debug("_read: {}".format(datas))

datas = None
self.log.debug("_read: {}".format(datas))
return datas
Expand Down Expand Up @@ -155,7 +159,9 @@ def _mesg(self, genre, *args, **kwargs):
ProtocolCode.GET_MOVEMENT_TYPE,
ProtocolCode.GET_REFERENCE_FRAME,
ProtocolCode.GET_JOINT_MIN_ANGLE,
ProtocolCode.GET_JOINT_MAX_ANGLE
ProtocolCode.GET_JOINT_MAX_ANGLE,
ProtocolCode.GET_FRESH_MODE,
# ProtocolCode.GET_SERVO_CURRENTS
]:
return self._process_single(res)
elif genre in [ProtocolCode.GET_ANGLES]:
Expand Down

0 comments on commit 9f90213

Please sign in to comment.