Skip to content

Commit 9f90213

Browse files
committed
release v3.0.2
1 parent 7cd0502 commit 9f90213

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# ChangeLog for pymycobot
22

3+
## v3.0.2 (2022-12-20)
4+
5+
- release v3.0.2
6+
- Fix MyBuddy interface problems:
7+
- Add get_fresh_mode()
8+
- remove get_servo_current()
9+
- get_servo_voltages()、get_servo_status()、get_servo_temps()
10+
311
## v3.0.1 (2022-12-9)
412

513
- release v3.0.1

pymycobot/Interface.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ def set_fresh_mode(self, id, mode):
137137
0 - Execute instructions sequentially in the form of a queue.
138138
"""
139139
return self._mesg(ProtocolCode.SET_FRESH_MODE, id, mode)
140+
141+
def get_fresh_mode(self, id):
142+
"""Get instruction refresh mode status
143+
144+
Args:
145+
id: 1/2 (L/R).
146+
"""
147+
return self._mesg(ProtocolCode.GET_FRESH_MODE, id, has_reply=True)
140148

141149
def set_free_mode(self, id, value):
142150
"""set free mode
@@ -939,27 +947,26 @@ def set_plan_acceleration(self, id, acceleration):
939947
ProtocolCode.SET_PLAN_ACCELERATION, id, acceleration
940948
)
941949

942-
def get_servo_currents(self, id):
943-
"""Get joint current
950+
# def get_servo_currents(self, id):
951+
# """Get joint current
944952

945-
Args:
946-
id: 1/2/3 (L/R/W)
953+
# Args:
954+
# id: 1/2/3 (L/R/W)
947955

948-
Return:
949-
value mA
950-
"""
951-
return self._mesg(ProtocolCode.GET_SERVO_VOLTAGES, id, has_reply=True)
956+
# Return:
957+
# value mA
958+
# """
959+
# return self._mesg(ProtocolCode.GET_SERVO_CURRENTS, id, has_reply=True)
952960

953961
def get_servo_voltages(self, id):
954962
"""Get joint voltages
955963
956964
Args:
957965
id: 1/2/3 (L/R/W)
958-
959966
Return:
960967
volts < 24 V
961968
"""
962-
return self._mesg(ProtocolCode.GET_SERVO_STATUS, id, has_reply=True)
969+
return self._mesg(ProtocolCode.GET_SERVO_VOLTAGES, id, has_reply=True)
963970

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

975982
def get_servo_temps(self, id):
976983
"""Get joint temperature
977984
978985
Args:
979986
id: 1/2/3 (L/R/W)
980987
"""
981-
return self._mesg(0xE6, id, has_reply=True)
988+
return self._mesg(ProtocolCode.GET_SERVO_TEMPS, id, has_reply=True)
982989

983990
def get_base_coords(self, *args):
984991
"""Convert coordinates to base coordinates. Pass in parameters or no parameters

pymycobot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from pymycobot.mybuddyemoticon import MyBuddyEmoticon
4444
__all__.append("MyBuddyEmoticon")
4545

46-
__version__ = "3.0.1"
46+
__version__ = "3.0.2"
4747
__author__ = "Elephantrobotics"
4848
__email__ = "[email protected]"
4949
__git_url__ = "https://github.com/elephantrobotics/pymycobot"

pymycobot/common.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ def _process_received(self, data, genre, arm=6):
289289

290290
# process valid data
291291
res = []
292+
if genre in [ProtocolCode.GET_SERVO_VOLTAGES, ProtocolCode.GET_SERVO_STATUS, ProtocolCode.GET_SERVO_TEMPS]:
293+
for i in valid_data:
294+
res.append(i)
295+
return res
292296
if data_len in [6, 8, 12, 14, 24, 60]:
293297
for header_i in range(0, len(valid_data), 2):
294298
one = valid_data[header_i : header_i + 2]

pymycobot/mybuddy.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,13 @@ def _read(self):
106106
datas = b'\xfe'
107107
pre = k
108108
except:
109+
self.log.debug("_read: {}".format(datas))
110+
109111
datas = None
110112
break
111113
else:
114+
self.log.debug("_read: {}".format(datas))
115+
112116
datas = None
113117
self.log.debug("_read: {}".format(datas))
114118
return datas
@@ -155,7 +159,9 @@ def _mesg(self, genre, *args, **kwargs):
155159
ProtocolCode.GET_MOVEMENT_TYPE,
156160
ProtocolCode.GET_REFERENCE_FRAME,
157161
ProtocolCode.GET_JOINT_MIN_ANGLE,
158-
ProtocolCode.GET_JOINT_MAX_ANGLE
162+
ProtocolCode.GET_JOINT_MAX_ANGLE,
163+
ProtocolCode.GET_FRESH_MODE,
164+
# ProtocolCode.GET_SERVO_CURRENTS
159165
]:
160166
return self._process_single(res)
161167
elif genre in [ProtocolCode.GET_ANGLES]:

0 commit comments

Comments
 (0)