Skip to content

Commit 9bcc570

Browse files
committed
release v3.1.6
1 parent 3ebd2f3 commit 9bcc570

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

pymycobot/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pymycobot.mypalletizersocket import MyPalletizerSocket
2020
from pymycobot.myarm import MyArm
2121
from pymycobot.elephantrobot import ElephantRobot
22+
from pymycobot.cobotx import CobotX
2223

2324
__all__ = [
2425
"MyCobot",
@@ -36,15 +37,16 @@
3637
"MyPalletizerSocket",
3738
"MechArm",
3839
"MyArm",
39-
"ElephantRobot"
40+
"ElephantRobot",
41+
"CobotX"
4042
]
4143

4244

4345
if sys.platform == "linux":
4446
from pymycobot.mybuddyemoticon import MyBuddyEmoticon
4547
__all__.append("MyBuddyEmoticon")
4648

47-
__version__ = "3.1.5"
49+
__version__ = "3.1.6"
4850
__author__ = "Elephantrobotics"
4951
__email__ = "weiquan.xu@elephantrobotics.com"
5052
__git_url__ = "https://github.com/elephantrobotics/pymycobot"

pymycobot/cobotx.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# coding=utf-8
2+
from pymycobot import MyArm
3+
4+
class CobotX(MyArm):
5+
def __init__(self, port, baudrate="115200", timeout=0.1, debug=False):
6+
super().__init__(port, baudrate, timeout, debug)

pymycobot/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class ProtocolCode(object):
9595
SET_GRIPPER_CALIBRATION = 0x68
9696
IS_GRIPPER_MOVING = 0x69
9797
SET_COLOR = 0x6A
98+
SET_COLOR_MYARM = 0x70
9899
SET_ELETRIC_GRIPPER = 0x6B
99100
INIT_ELETRIC_GRIPPER = 0x6C
100101
SET_GRIPPER_MODE = 0x6D
@@ -382,6 +383,7 @@ def write(self, command, method=None):
382383
data = b""
383384
return data
384385
else:
386+
# with self.lock:
385387
self.log.debug("_write: {}".format([hex(i) for i in command]))
386388
self._serial_port.write(command)
387389
self._serial_port.flush()

pymycobot/myarm.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ def sync_send_angles(self, degrees, speed, timeout=7):
157157
"""Send the angle in synchronous state and return when the target point is reached
158158
159159
Args:
160-
degrees: a list of degree values(List[float]), length 6.
160+
degrees: a list of degree values(List[float]), length 7.
161161
speed: (int) 0 ~ 100
162162
timeout: default 7s.
163163
"""
164164
t = time.time()
165165
self.send_angles(degrees, speed)
166166
while time.time() - t < timeout:
167167
f = self.is_in_position(degrees, 0)
168-
if f:
168+
if f == 1:
169169
break
170170
time.sleep(0.1)
171171
return self
@@ -182,7 +182,7 @@ def sync_send_coords(self, coords, speed, mode, timeout=7):
182182
t = time.time()
183183
self.send_coords(coords, speed, mode)
184184
while time.time() - t < timeout:
185-
if self.is_in_position(coords, 1):
185+
if self.is_in_position(coords, 1) == 1:
186186
break
187187
time.sleep(0.1)
188188
return self
@@ -258,4 +258,13 @@ def close(self):
258258

259259
def open(self):
260260
self._serial_port.open()
261-
261+
262+
def set_color(self, r, g, b):
263+
"""Set the color of the LED
264+
265+
Args:
266+
r: Red
267+
g: Green
268+
b: Blue
269+
"""
270+
return self._mesg(ProtocolCode.SET_COLOR_MYARM, r, g, b)

pymycobot/mycobot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def sync_send_angles(self, degrees, speed, timeout=7):
168168
self.send_angles(degrees, speed)
169169
while time.time() - t < timeout:
170170
f = self.is_in_position(degrees, 0)
171-
if f:
171+
if f == 1:
172172
break
173173
time.sleep(0.1)
174174
return self
@@ -185,7 +185,7 @@ def sync_send_coords(self, coords, speed, mode, timeout=7):
185185
t = time.time()
186186
self.send_coords(coords, speed, mode)
187187
while time.time() - t < timeout:
188-
if self.is_in_position(coords, 1):
188+
if self.is_in_position(coords, 1) == 1:
189189
break
190190
time.sleep(0.1)
191191
return self

0 commit comments

Comments
 (0)