pymycobot 3.5.0.dev7__tar.gz → 3.5.0.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pymycobot-3.5.0.dev7/pymycobot.egg-info → pymycobot-3.5.0.dev8}/PKG-INFO +1 -1
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/__init__.py +1 -1
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/common.py +3 -25
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/error.py +11 -41
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/log.py +0 -6
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mercury.py +1 -2
- pymycobot-3.5.0.dev8/pymycobot/mercury_api.py +1064 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mercurysocket.py +2 -2
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8/pymycobot.egg-info}/PKG-INFO +1 -1
- pymycobot-3.5.0.dev7/pymycobot/mercury_api.py +0 -1654
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/LICENSE +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/MANIFEST.in +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/README.md +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/Interface.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/bluet.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/elephantrobot.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/generate.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/genre.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mecharm.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mecharmsocket.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mercurychassis.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/myagv.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/myarm.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/myarm_api.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/myarmc.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/myarmm.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/myarmsocket.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mybuddy.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mybuddybluetooth.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mybuddyemoticon.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mybuddysocket.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mycobot.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mycobotpro630.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mycobotsocket.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mypalletizer.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/mypalletizersocket.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/progripper.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/public.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/ultraArm.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot/utils.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot.egg-info/SOURCES.txt +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot.egg-info/dependency_links.txt +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot.egg-info/requires.txt +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/pymycobot.egg-info/top_level.txt +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/requirements.txt +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/setup.cfg +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/setup.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/tests/test_api.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/tests/test_generator.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/tests/test_socket.py +0 -0
- {pymycobot-3.5.0.dev7 → pymycobot-3.5.0.dev8}/tests/test_utils.py +0 -0
|
@@ -61,7 +61,7 @@ if sys.platform == "linux":
|
|
|
61
61
|
from pymycobot.mybuddyemoticon import MyBuddyEmoticon
|
|
62
62
|
__all__.append("MyBuddyEmoticon")
|
|
63
63
|
|
|
64
|
-
__version__ = "3.5.
|
|
64
|
+
__version__ = "3.5.0dev8"
|
|
65
65
|
__author__ = "Elephantrobotics"
|
|
66
66
|
__email__ = "weiquan.xu@elephantrobotics.com"
|
|
67
67
|
__git_url__ = "https://github.com/elephantrobotics/pymycobot"
|
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
from __future__ import division
|
|
4
4
|
import time
|
|
5
5
|
import struct
|
|
6
|
-
import logging
|
|
7
6
|
import sys
|
|
8
7
|
|
|
9
|
-
from pymycobot.log import setup_logging
|
|
10
|
-
from pymycobot.error import calibration_parameters
|
|
11
|
-
|
|
12
8
|
|
|
13
9
|
class ProtocolCode(object):
|
|
14
10
|
# BASIC
|
|
@@ -81,14 +77,11 @@ class ProtocolCode(object):
|
|
|
81
77
|
JOG_ABSOLUTE = 0x31
|
|
82
78
|
JOG_COORD = 0x32
|
|
83
79
|
JOG_INCREMENT = 0x33
|
|
84
|
-
JOG_INCREMENT_COORD = 0x34
|
|
85
|
-
|
|
86
80
|
JOG_STOP = 0x34
|
|
87
81
|
JOG_INCREMENT_COORD = 0x34
|
|
88
82
|
|
|
89
83
|
COBOTX_GET_SOLUTION_ANGLES = 0x35
|
|
90
84
|
COBOTX_SET_SOLUTION_ANGLES = 0x36
|
|
91
|
-
JOG_BASE_INCREMENT_COORD = 0x37
|
|
92
85
|
|
|
93
86
|
SET_ENCODER = 0x3A
|
|
94
87
|
GET_ENCODER = 0x3B
|
|
@@ -100,8 +93,6 @@ class ProtocolCode(object):
|
|
|
100
93
|
GET_SPEED = 0x40
|
|
101
94
|
SET_SPEED = 0x41
|
|
102
95
|
GET_FEED_OVERRIDE = 0x42
|
|
103
|
-
GET_MAX_ACC = 0x42
|
|
104
|
-
SET_MAX_ACC = 0x43
|
|
105
96
|
GET_ACCELERATION = 0x44
|
|
106
97
|
SET_ACCELERATION = 0x45
|
|
107
98
|
GET_JOINT_MIN_ANGLE = 0x4A
|
|
@@ -211,7 +202,7 @@ class ProtocolCode(object):
|
|
|
211
202
|
GET_JOINT_CURRENT = 0x91
|
|
212
203
|
SET_CURRENT_STATE = 0x92
|
|
213
204
|
GET_POS_OVER = 0x94
|
|
214
|
-
CLEAR_ENCODERS_ERROR =
|
|
205
|
+
CLEAR_ENCODERS_ERROR = 0x95
|
|
215
206
|
GET_DOWN_ENCODERS = 0x96
|
|
216
207
|
|
|
217
208
|
# planning speed
|
|
@@ -233,15 +224,13 @@ class ProtocolCode(object):
|
|
|
233
224
|
GET_SERVO_LASTPDI = 0xE6
|
|
234
225
|
SERVO_RESTORE = 0xE7
|
|
235
226
|
SET_VOID_COMPENSATE = 0xE7
|
|
236
|
-
|
|
237
|
-
|
|
227
|
+
SET_ERROR_DETECT_MODE = 0xE8
|
|
228
|
+
GET_ERROR_DETECT_MODE = 0xE9
|
|
238
229
|
|
|
239
230
|
MERCURY_GET_BASE_COORDS = 0xF0
|
|
240
231
|
MERCURY_SET_BASE_COORD = 0xF1
|
|
241
232
|
MERCURY_SET_BASE_COORDS = 0xF2
|
|
242
233
|
MERCURY_JOG_BASE_COORD = 0xF3
|
|
243
|
-
GET_MONITOR_MODE = 0xFB
|
|
244
|
-
SET_MONITOR_MODE = 0xFC
|
|
245
234
|
|
|
246
235
|
MERCURY_DRAG_TECH_SAVE = 0x70
|
|
247
236
|
MERCURY_DRAG_TECH_EXECUTE = 0x71
|
|
@@ -325,17 +314,6 @@ class ProtocolCode(object):
|
|
|
325
314
|
|
|
326
315
|
|
|
327
316
|
class DataProcessor(object):
|
|
328
|
-
def __init__(self, debug=False):
|
|
329
|
-
"""
|
|
330
|
-
Args:
|
|
331
|
-
debug : whether show debug info
|
|
332
|
-
"""
|
|
333
|
-
self._version = sys.version_info[:2][0]
|
|
334
|
-
self.debug = debug
|
|
335
|
-
setup_logging(self.debug)
|
|
336
|
-
self.log = logging.getLogger(__name__)
|
|
337
|
-
self.calibration_parameters = calibration_parameters
|
|
338
|
-
|
|
339
317
|
def _mesg(self, genre, *args, **kwargs):
|
|
340
318
|
"""
|
|
341
319
|
Args:
|
|
@@ -149,7 +149,7 @@ def public_check(parameter_list, kwargs, robot_limit, class_name, exception_clas
|
|
|
149
149
|
# TODO 280/320共用MyCobot,无法进行数据限位
|
|
150
150
|
# elif parameter == 'coords':
|
|
151
151
|
# check_coords(value, robot_limit, class_name, exception_class)
|
|
152
|
-
elif parameter in ['rftype', 'move_type', 'end', 'is_linear', 'status', 'mode', 'direction'
|
|
152
|
+
elif parameter in ['rftype', 'move_type', 'end', 'is_linear', 'status', 'mode', 'direction']:
|
|
153
153
|
check_0_or_1(parameter, value, [0, 1],
|
|
154
154
|
value_type, exception_class, int)
|
|
155
155
|
elif parameter == 'acceleration':
|
|
@@ -244,7 +244,7 @@ def calibration_parameters(**kwargs):
|
|
|
244
244
|
"coords_max": [441.37, 441.37, 628.02, 180, 180, 180]
|
|
245
245
|
},
|
|
246
246
|
"MercurySocket": {
|
|
247
|
-
"id": [1, 2, 3, 4, 5, 6, 11, 12],
|
|
247
|
+
"id": [1, 2, 3, 4, 5, 6, 11, 12, 13],
|
|
248
248
|
"angles_min": [-165, -55, -173, -165, -20, -180, -60, -138],
|
|
249
249
|
"angles_max": [165, 95, 5, 165, 265, 180, 0, 188],
|
|
250
250
|
"coords_min": [-441.37, -441.37, -206.52, -180, -180, -180],
|
|
@@ -346,10 +346,11 @@ def calibration_parameters(**kwargs):
|
|
|
346
346
|
[parameter], MercuryDataException)
|
|
347
347
|
elif parameter == 'angle':
|
|
348
348
|
id = kwargs.get('id', None)
|
|
349
|
-
if id in [11, 12
|
|
350
|
-
index =
|
|
349
|
+
if id in [11, 12]:
|
|
350
|
+
index = id - 5
|
|
351
351
|
else:
|
|
352
352
|
index = robot_limit[class_name]['id'][id-1] - 1
|
|
353
|
+
print(index)
|
|
353
354
|
if value < robot_limit[class_name]["angles_min"][index] or value > robot_limit[class_name]["angles_max"][index]:
|
|
354
355
|
raise MercuryDataException(
|
|
355
356
|
"angle value not right, should be {0} ~ {1}, but received {2}".format(
|
|
@@ -388,7 +389,8 @@ def calibration_parameters(**kwargs):
|
|
|
388
389
|
|
|
389
390
|
elif parameter == 'rgb':
|
|
390
391
|
check_rgb_value(value, MercuryDataException, class_name)
|
|
391
|
-
|
|
392
|
+
# if direction is not None:
|
|
393
|
+
elif parameter in ['direction', 'flag', 'value']:
|
|
392
394
|
if value not in [0, 1]:
|
|
393
395
|
raise MercuryDataException(
|
|
394
396
|
"{} only supports 0 or 1, but received {}".format(parameter, value))
|
|
@@ -403,17 +405,17 @@ def calibration_parameters(**kwargs):
|
|
|
403
405
|
raise MercuryDataException(
|
|
404
406
|
"The angle range is -90° ~ 90°, but received {}".format(value))
|
|
405
407
|
elif parameter == 'address':
|
|
406
|
-
if value <
|
|
408
|
+
if value < 32 or value > 34:
|
|
407
409
|
raise MercuryDataException(
|
|
408
|
-
"The address
|
|
410
|
+
"The angle address is 32 ~ 34, but received {}".format(value))
|
|
409
411
|
elif parameter == 'value':
|
|
410
412
|
if value < 1 or value > 32000:
|
|
411
413
|
raise MercuryDataException(
|
|
412
414
|
"The angle value is 1 ~ 32000, but received {}".format(value))
|
|
413
415
|
elif parameter == "servo_restore":
|
|
414
|
-
if value not in [1, 2, 3, 4, 5, 6, 254]:
|
|
416
|
+
if value not in [1, 2, 3, 4, 5, 6, 7, 13, 254]:
|
|
415
417
|
raise MercuryDataException(
|
|
416
|
-
"The joint_id should be in [1,2,3,4,5,6
|
|
418
|
+
"The joint_id should be in [1,2,3,4,5,6,7,13,254], but received {}".format(value))
|
|
417
419
|
elif parameter == "data_len":
|
|
418
420
|
if value < 1 or value > 45:
|
|
419
421
|
raise MercuryDataException(
|
|
@@ -422,38 +424,6 @@ def calibration_parameters(**kwargs):
|
|
|
422
424
|
if value < 0:
|
|
423
425
|
raise MercuryDataException(
|
|
424
426
|
"The parameter max_time must be greater than or equal to 0, but received {}".format(value))
|
|
425
|
-
elif parameter == "max_acc":
|
|
426
|
-
mode = kwargs.get("mode", None)
|
|
427
|
-
if mode == 0:
|
|
428
|
-
if value < 1 or value > 150:
|
|
429
|
-
raise MercuryDataException(
|
|
430
|
-
"The parameter max_acc data range only supports 1 ~ 150, but received {}".format(value))
|
|
431
|
-
elif mode == 1:
|
|
432
|
-
if value < 1 or value > 400:
|
|
433
|
-
raise MercuryDataException(
|
|
434
|
-
"The parameter max_acc data range only supports 1 ~ 400, but received {}".format(value))
|
|
435
|
-
elif parameter == "servo_id":
|
|
436
|
-
if value not in [11,12]:
|
|
437
|
-
raise MercuryDataException(
|
|
438
|
-
"The parameter servo_id data range only supports 11 or 12, but received {}".format(value))
|
|
439
|
-
elif parameter == "max_speed":
|
|
440
|
-
mode = kwargs.get("mode", None)
|
|
441
|
-
if mode == 0:
|
|
442
|
-
min_speed = 1
|
|
443
|
-
max_speed = 150
|
|
444
|
-
if value < min_speed or value > max_speed:
|
|
445
|
-
raise MercuryDataException(
|
|
446
|
-
"The parameter max_speed data range only supports {} ~ {}, but received {}".format(min_speed, max_speed, value))
|
|
447
|
-
elif mode == 1:
|
|
448
|
-
min_speed = 1
|
|
449
|
-
max_speed = 200
|
|
450
|
-
if value < min_speed or value > max_speed:
|
|
451
|
-
raise MercuryDataException(
|
|
452
|
-
"The parameter max_speed data range only supports {} ~ {}, but received {}".format(min_speed, max_speed, value))
|
|
453
|
-
elif parameter in ['gripper_type', 'pin_no']:
|
|
454
|
-
value_type = type(value)
|
|
455
|
-
check_0_or_1(parameter, value, [1, 2], value_type, MercuryDataException, int)
|
|
456
|
-
|
|
457
427
|
elif class_name == "MyAgv":
|
|
458
428
|
for parameter in parameter_list[1:]:
|
|
459
429
|
value = kwargs.get(parameter, None)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
import logging.handlers
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
def setup_logging(debug=False):
|
|
@@ -15,11 +14,6 @@ def setup_logging(debug=False):
|
|
|
15
14
|
logger_handle.setFormatter(debug_fomatter)
|
|
16
15
|
if debug:
|
|
17
16
|
logger_handle.setLevel(logging.DEBUG)
|
|
18
|
-
# 100M日志
|
|
19
|
-
save = logging.handlers.RotatingFileHandler(
|
|
20
|
-
"python_debug.log", maxBytes=100*1024*1024, backupCount=1)
|
|
21
|
-
save.setFormatter(debug_fomatter)
|
|
22
|
-
root_logger.addHandler(save)
|
|
23
17
|
else:
|
|
24
18
|
logger_handle.setLevel(logging.WARNING)
|
|
25
19
|
|
|
@@ -29,8 +29,7 @@ class Mercury(MercuryCommandGenerator):
|
|
|
29
29
|
self.lock = threading.Lock()
|
|
30
30
|
self.has_reply_command = []
|
|
31
31
|
self.is_stop = False
|
|
32
|
-
self.read_threading = threading.Thread(target=self.read_thread)
|
|
33
|
-
self.read_threading.daemon = True
|
|
32
|
+
self.read_threading = threading.Thread(target=self.read_thread, daemon=True)
|
|
34
33
|
self.read_threading.start()
|
|
35
34
|
|
|
36
35
|
def open(self):
|