xArm-Python-SDK 1.13.8__tar.gz → 1.14.7__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.
- {xArm-Python-SDK-1.13.8/xArm_Python_SDK.egg-info → xarm_python_sdk-1.14.7}/PKG-INFO +10 -10
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/README.md +17 -7
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/setup.cfg +4 -4
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/setup.py +5 -2
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7/xArm_Python_SDK.egg-info}/PKG-INFO +10 -10
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xArm_Python_SDK.egg-info/SOURCES.txt +2 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xArm_Python_SDK.egg-info/not-zip-safe +1 -1
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/comm/base.py +1 -1
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/config/x_code.py +40 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/config/x_config.py +50 -1
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/utils/convert.py +2 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/wrapper/uxbus_cmd.py +133 -34
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/wrapper/uxbus_cmd_tcp.py +1 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/blockly/_blockly_base.py +37 -2
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/blockly/_blockly_handler.py +253 -13
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/blockly/_blockly_tool.py +128 -32
- xarm_python_sdk-1.14.7/xarm/tools/gcode.py +78 -0
- xarm_python_sdk-1.14.7/xarm/tools/modbus_tcp.py +194 -0
- xarm_python_sdk-1.14.7/xarm/version.py +1 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/wrapper/xarm_api.py +336 -39
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/base.py +92 -9
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/base_board.py +56 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/ft_sensor.py +2 -1
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/gpio.py +48 -24
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/gripper.py +42 -14
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/modbus_tcp.py +4 -1
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/parse.py +2 -2
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/xarm.py +113 -26
- xArm-Python-SDK-1.13.8/xarm/version.py +0 -1
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/LICENSE +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xArm_Python_SDK.egg-info/dependency_links.txt +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xArm_Python_SDK.egg-info/top_level.txt +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/comm/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/comm/serial_port.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/comm/socket_port.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/comm/uxbus_cmd_protocol.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/config/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/utils/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/utils/crc16.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/utils/debug_print.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/utils/log.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/version.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/wrapper/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/core/wrapper/uxbus_cmd_ser.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/blockly/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/blockly/_blockly_highlight.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/blockly/_blockly_node.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/blockly_tool.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/list_ports.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/threads.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/tools/utils.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/wrapper/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/wrapper/studio_api.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/__init__.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/code.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/decorator.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/events.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/grammar_async.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/grammar_coroutine.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/record.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/report.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/robotiq.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/servo.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/studio.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/track.py +0 -0
- {xArm-Python-SDK-1.13.8 → xarm_python_sdk-1.14.7}/xarm/x3/utils.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: xArm-Python-SDK
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: Python SDK for xArm
|
|
5
|
-
Author: Vinman
|
|
6
|
-
Author-email: vinman@ufactory.cc
|
|
7
|
-
License: MIT
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
|
|
10
|
-
long description for xArm-Python-SDK
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: xArm-Python-SDK
|
|
3
|
+
Version: 1.14.7
|
|
4
|
+
Summary: Python SDK for xArm
|
|
5
|
+
Author: Vinman
|
|
6
|
+
Author-email: vinman@ufactory.cc
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
|
|
10
|
+
long description for xArm-Python-SDK
|
|
@@ -30,6 +30,23 @@ xArm Python SDK
|
|
|
30
30
|
- #### [UFACTORY ModbusTCP Manual](doc/UF_ModbusTCP_Manual.md)
|
|
31
31
|
|
|
32
32
|
## Update Summary
|
|
33
|
+
- > ### 1.14.7
|
|
34
|
+
- Fixed the problem that single joint or direction movement fails in some cases (valid from firmware 2.5.0)
|
|
35
|
+
- Added standard ModbusTcp client and Gcode client
|
|
36
|
+
- GPIO control supports immediate execution
|
|
37
|
+
- Support new version of vacuum gripper
|
|
38
|
+
- Support the studio-2.5.0 blockly project conversion to python
|
|
39
|
+
|
|
40
|
+
- > ### 1.13.30
|
|
41
|
+
- Supports obtaining unsaved track recording duration
|
|
42
|
+
- Fix the abnormal path of running blockly program in some cases
|
|
43
|
+
- Fix the return format of getting C23 and C38 errors
|
|
44
|
+
- Supports obtaining identification status
|
|
45
|
+
|
|
46
|
+
- > ### 1.13.19
|
|
47
|
+
- Friction identification supports xarm7_mirror model
|
|
48
|
+
- Fix the abnormal return value of blockly conversion robotiq related interface
|
|
49
|
+
|
|
33
50
|
- > ### 1.13.0
|
|
34
51
|
- Compatible with the standard Modbus TCP protocol, providing part of the standard Modbus TCP protocol interface
|
|
35
52
|
|
|
@@ -44,13 +61,6 @@ xArm Python SDK
|
|
|
44
61
|
- Add common motion api (Enabled after firmware version 1.11.100)
|
|
45
62
|
- The Cartesian motion-related interface adds the motion_type parameter to determine the planning method (Enabled after firmware version 1.11.100)
|
|
46
63
|
|
|
47
|
-
- > ### 1.11.0
|
|
48
|
-
- Support transparent transmission
|
|
49
|
-
- 240: `set_tgpio_modbus_timeout(..., is_transparent_transmission=True)`
|
|
50
|
-
- 241: `getset_tgpio_modbus_data(..., is_transparent_transmission=True)`
|
|
51
|
-
- Modified the centroid unit of the `ft_sensor_iden_load` and `ft_sensor_cali_load` interfaces to millimeters (originally meters)
|
|
52
|
-
|
|
53
|
-
|
|
54
64
|
- >### [More](ReleaseNotes.md)
|
|
55
65
|
|
|
56
66
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
@@ -39,8 +39,11 @@ version = main_ns['__version__']
|
|
|
39
39
|
# long_description = open('README.rst').read()
|
|
40
40
|
long_description = 'long description for xArm-Python-SDK'
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
try:
|
|
43
|
+
with open(os.path.join(os.getcwd(), 'requirements.txt')) as f:
|
|
44
|
+
requirements = f.read().splitlines()
|
|
45
|
+
except:
|
|
46
|
+
requirements = []
|
|
44
47
|
|
|
45
48
|
setup(
|
|
46
49
|
name='xArm-Python-SDK',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: xArm-Python-SDK
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: Python SDK for xArm
|
|
5
|
-
Author: Vinman
|
|
6
|
-
Author-email: vinman@ufactory.cc
|
|
7
|
-
License: MIT
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
|
|
10
|
-
long description for xArm-Python-SDK
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: xArm-Python-SDK
|
|
3
|
+
Version: 1.14.7
|
|
4
|
+
Summary: Python SDK for xArm
|
|
5
|
+
Author: Vinman
|
|
6
|
+
Author-email: vinman@ufactory.cc
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
|
|
10
|
+
long description for xArm-Python-SDK
|
|
@@ -29,7 +29,9 @@ xarm/core/wrapper/uxbus_cmd_ser.py
|
|
|
29
29
|
xarm/core/wrapper/uxbus_cmd_tcp.py
|
|
30
30
|
xarm/tools/__init__.py
|
|
31
31
|
xarm/tools/blockly_tool.py
|
|
32
|
+
xarm/tools/gcode.py
|
|
32
33
|
xarm/tools/list_ports.py
|
|
34
|
+
xarm/tools/modbus_tcp.py
|
|
33
35
|
xarm/tools/threads.py
|
|
34
36
|
xarm/tools/utils.py
|
|
35
37
|
xarm/tools/blockly/__init__.py
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -197,7 +197,7 @@ class Port(threading.Thread):
|
|
|
197
197
|
buffer = buffer[233:]
|
|
198
198
|
continue
|
|
199
199
|
|
|
200
|
-
if convert.bytes_to_u32(buffer[0:4]) != size:
|
|
200
|
+
if convert.bytes_to_u32(buffer[0:4]) != size and not (size_is_not_confirm and size == 245 and convert.bytes_to_u32(buffer[0:4]) == 233):
|
|
201
201
|
logger.error('report data error, close, length={}, size={}'.format(convert.bytes_to_u32(buffer[0:4]), size))
|
|
202
202
|
break
|
|
203
203
|
|
|
@@ -248,6 +248,16 @@ ServoCodeMap = {
|
|
|
248
248
|
'desc': '请通过控制器上的紧急停止按钮重启机械臂。如多次重启无效,请联系技术支持。',
|
|
249
249
|
}
|
|
250
250
|
},
|
|
251
|
+
58: {
|
|
252
|
+
'en': {
|
|
253
|
+
'title': 'Torque Command Timeout',
|
|
254
|
+
'desc': 'Please check the connection between the Control Box and the robot.',
|
|
255
|
+
},
|
|
256
|
+
'cn': {
|
|
257
|
+
'title': '转矩指令超时',
|
|
258
|
+
'desc': '请检查控制器与机械臂的连接。',
|
|
259
|
+
}
|
|
260
|
+
},
|
|
251
261
|
'other': {
|
|
252
262
|
'en': {
|
|
253
263
|
'title': 'Joint Error',
|
|
@@ -744,6 +754,26 @@ ControllerErrorCodeMap = {
|
|
|
744
754
|
'desc': '请调整点位。'
|
|
745
755
|
}
|
|
746
756
|
},
|
|
757
|
+
41: {
|
|
758
|
+
'en': {
|
|
759
|
+
'title': 'The content of the friction file is invalid.',
|
|
760
|
+
'desc': 'Please restart the robot with the Emergency Stop Button on the Control Box. If multiple reboots do not work, please contact technical support.'
|
|
761
|
+
},
|
|
762
|
+
'cn': {
|
|
763
|
+
'title': '摩擦力文件内容无效。',
|
|
764
|
+
'desc': '请通过控制器上的紧急停止按钮重启机械臂。如多次重启无效,请联系技术支持'
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
42: {
|
|
768
|
+
'en': {
|
|
769
|
+
'title': 'The content of the calibration file is invalid.',
|
|
770
|
+
'desc': 'Please restart the robot with the Emergency Stop Button on the Control Box. If multiple reboots do not work, please contact technical support.'
|
|
771
|
+
},
|
|
772
|
+
'cn': {
|
|
773
|
+
'title': '校准文件内容无效。',
|
|
774
|
+
'desc': '请通过控制器上的紧急停止按钮重启机械臂。如多次重启无效,请联系技术支持'
|
|
775
|
+
}
|
|
776
|
+
},
|
|
747
777
|
50: {
|
|
748
778
|
'en': {
|
|
749
779
|
'title': 'Six-axis Force Torque Sensor read error',
|
|
@@ -784,6 +814,16 @@ ControllerErrorCodeMap = {
|
|
|
784
814
|
'desc': ''
|
|
785
815
|
}
|
|
786
816
|
},
|
|
817
|
+
60: {
|
|
818
|
+
'en': {
|
|
819
|
+
'title': 'Linear speed exceeded limit in servo_j mode.',
|
|
820
|
+
'desc': 'Linear speed limit is {} mm/s, current linear speed {} mm/s.'
|
|
821
|
+
},
|
|
822
|
+
'cn': {
|
|
823
|
+
'title': '关节伺服模式线速度超过限制',
|
|
824
|
+
'desc': '线速度限制值{}mm/s,当前线速度{}mm/s'
|
|
825
|
+
}
|
|
826
|
+
},
|
|
787
827
|
110: {
|
|
788
828
|
'en': {
|
|
789
829
|
'title': 'Robot Arm Base Board Communication Error',
|
|
@@ -40,6 +40,10 @@ class XCONF(object):
|
|
|
40
40
|
XARM6_X9 = 9
|
|
41
41
|
XARM6_X11 = 11
|
|
42
42
|
XARM6_X12 = 12
|
|
43
|
+
XARM7_X13 = 13
|
|
44
|
+
XARM5_X4_1305 = 51305
|
|
45
|
+
XARM6_X4_1305 = 61305
|
|
46
|
+
XARM7_X4_1305 = 71305
|
|
43
47
|
|
|
44
48
|
JOINT_LIMITS = {
|
|
45
49
|
Axis.XARM5: {
|
|
@@ -50,6 +54,13 @@ class XCONF(object):
|
|
|
50
54
|
(-1.692969, math.pi), # (-1.75, math.pi),
|
|
51
55
|
(-2 * math.pi, 2 * math.pi)
|
|
52
56
|
],
|
|
57
|
+
Type.XARM5_X4_1305: [
|
|
58
|
+
(-2 * math.pi, 2 * math.pi),
|
|
59
|
+
(-2.042035, 2.024581),
|
|
60
|
+
(-3.822271, 0.174532),
|
|
61
|
+
(-1.692969, math.pi), # (-1.75, math.pi),
|
|
62
|
+
(-2 * math.pi, 2 * math.pi)
|
|
63
|
+
],
|
|
53
64
|
},
|
|
54
65
|
Axis.XARM6: {
|
|
55
66
|
Type.XARM6_X4: [
|
|
@@ -60,6 +71,14 @@ class XCONF(object):
|
|
|
60
71
|
(-1.692969, math.pi), # (-1.75, math.pi),
|
|
61
72
|
(-2 * math.pi, 2 * math.pi)
|
|
62
73
|
],
|
|
74
|
+
Type.XARM6_X4_1305: [
|
|
75
|
+
(-2 * math.pi, 2 * math.pi),
|
|
76
|
+
(-2.042035, 2.024581),
|
|
77
|
+
(-3.822271, 0.174532),
|
|
78
|
+
(-2 * math.pi, 2 * math.pi),
|
|
79
|
+
(-1.692969, math.pi), # (-1.75, math.pi),
|
|
80
|
+
(-2 * math.pi, 2 * math.pi)
|
|
81
|
+
],
|
|
63
82
|
Type.XARM6_X8: [
|
|
64
83
|
(-2 * math.pi, 2 * math.pi),
|
|
65
84
|
(-2.059488, 2.094395), # (-2.18, 2.18),
|
|
@@ -113,6 +132,24 @@ class XCONF(object):
|
|
|
113
132
|
(-1.692969, math.pi), # (-1.75, math.pi),
|
|
114
133
|
(-2 * math.pi, 2 * math.pi)
|
|
115
134
|
],
|
|
135
|
+
Type.XARM7_X4_1305: [
|
|
136
|
+
(-2 * math.pi, 2 * math.pi),
|
|
137
|
+
(-2.042035, 2.024581),
|
|
138
|
+
(-2 * math.pi, 2 * math.pi),
|
|
139
|
+
(-0.10472, 3.92699),
|
|
140
|
+
(-2 * math.pi, 2 * math.pi),
|
|
141
|
+
(-1.692969, math.pi), # (-1.75, math.pi),
|
|
142
|
+
(-2 * math.pi, 2 * math.pi)
|
|
143
|
+
],
|
|
144
|
+
Type.XARM7_X13: [
|
|
145
|
+
(-2 * math.pi, 2 * math.pi),
|
|
146
|
+
(-2.094395, 2.059488), # (-2.18, 2.18),
|
|
147
|
+
(-2 * math.pi, 2 * math.pi),
|
|
148
|
+
(-3.92699, 0.191986),
|
|
149
|
+
(-2 * math.pi, 2 * math.pi),
|
|
150
|
+
(-math.pi, 1.692969),
|
|
151
|
+
(-2 * math.pi, 2 * math.pi)
|
|
152
|
+
]
|
|
116
153
|
}
|
|
117
154
|
}
|
|
118
155
|
TCP_LIMITS = {
|
|
@@ -193,6 +230,14 @@ class XCONF(object):
|
|
|
193
230
|
(-math.pi, math.pi),
|
|
194
231
|
(-math.pi, math.pi)
|
|
195
232
|
],
|
|
233
|
+
Type.XARM7_X13: [
|
|
234
|
+
(-750, 750),
|
|
235
|
+
(-750, 750),
|
|
236
|
+
(-400, 1000),
|
|
237
|
+
(-math.pi, math.pi),
|
|
238
|
+
(-math.pi, math.pi),
|
|
239
|
+
(-math.pi, math.pi)
|
|
240
|
+
]
|
|
196
241
|
}
|
|
197
242
|
}
|
|
198
243
|
|
|
@@ -370,8 +415,12 @@ class XCONF(object):
|
|
|
370
415
|
IMPEDANCE_CTRL_MBK = 210
|
|
371
416
|
IMPEDANCE_CTRL_CONFIG = 211
|
|
372
417
|
FTSENSOR_GET_CONFIG = 212
|
|
373
|
-
|
|
418
|
+
|
|
419
|
+
GET_TRAJ_SPEEDING = 230
|
|
374
420
|
GET_MAX_JOINT_VELOCITY = 231
|
|
421
|
+
SET_COMMON_PARAM = 232
|
|
422
|
+
GET_COMMON_PARAM = 233
|
|
423
|
+
GET_COMMON_INFO = 234
|
|
375
424
|
|
|
376
425
|
TGPIO_COM_TIOUT = 240
|
|
377
426
|
TGPIO_COM_DATA = 241
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
|
|
9
9
|
|
|
10
10
|
import time
|
|
11
|
+
import math
|
|
11
12
|
import threading
|
|
12
13
|
import functools
|
|
13
14
|
from ..utils import convert
|
|
@@ -110,9 +111,13 @@ class UxbusCmd(object):
|
|
|
110
111
|
return self.recv_modbus_response(funcode, ret, num, self._G_TOUT)
|
|
111
112
|
|
|
112
113
|
@lock_require
|
|
113
|
-
def set_nu16(self, funcode, datas, num):
|
|
114
|
+
def set_nu16(self, funcode, datas, num, additional_bytes=None):
|
|
114
115
|
hexdata = convert.u16s_to_bytes(datas, num)
|
|
115
|
-
|
|
116
|
+
if additional_bytes is not None:
|
|
117
|
+
hexdata += additional_bytes
|
|
118
|
+
ret = self.send_modbus_request(funcode, hexdata, num * 2 + len(additional_bytes))
|
|
119
|
+
else:
|
|
120
|
+
ret = self.send_modbus_request(funcode, hexdata, num * 2)
|
|
116
121
|
if ret == -1:
|
|
117
122
|
return [XCONF.UxbusState.ERR_NOTTCP]
|
|
118
123
|
ret = self.recv_modbus_response(funcode, ret, 0, self._S_TOUT)
|
|
@@ -503,7 +508,7 @@ class UxbusCmd(object):
|
|
|
503
508
|
txdata = [mvjoint[i] for i in range(7)]
|
|
504
509
|
txdata += [mvvelo, mvacc, mvradii]
|
|
505
510
|
if only_check_type <= 0:
|
|
506
|
-
return self.set_nfp32(XCONF.UxbusReg.MOVE_JOINTB, txdata, 10)
|
|
511
|
+
return self.set_nfp32(XCONF.UxbusReg.MOVE_JOINTB, txdata, 10, feedback_key=feedback_key)
|
|
507
512
|
else:
|
|
508
513
|
byte_data = bytes([only_check_type])
|
|
509
514
|
return self.set_nfp32_with_bytes(XCONF.UxbusReg.MOVE_JOINTB, txdata, 10, byte_data, 3, timeout=10, feedback_key=feedback_key)
|
|
@@ -562,7 +567,7 @@ class UxbusCmd(object):
|
|
|
562
567
|
|
|
563
568
|
def move_circle_common(self, pose1, pose2, mvvelo, mvacc, mvtime, percent, coord=0, is_axis_angle=False, only_check_type=0, feedback_key=None):
|
|
564
569
|
"""
|
|
565
|
-
|
|
570
|
+
通用指令, 固件1.10.0开始支持
|
|
566
571
|
"""
|
|
567
572
|
txdata = [0] * 16
|
|
568
573
|
for i in range(6):
|
|
@@ -679,11 +684,15 @@ class UxbusCmd(object):
|
|
|
679
684
|
return self.gripper_addr_w16(XCONF.ServoConf.RESET_ERR, 1)
|
|
680
685
|
|
|
681
686
|
@lock_require
|
|
682
|
-
def tgpio_addr_w16(self, addr, value, bid=XCONF.TGPIO_HOST_ID):
|
|
687
|
+
def tgpio_addr_w16(self, addr, value, bid=XCONF.TGPIO_HOST_ID, additional_bytes=None):
|
|
683
688
|
txdata = bytes([bid])
|
|
684
689
|
txdata += convert.u16_to_bytes(addr)
|
|
685
690
|
txdata += convert.fp32_to_bytes(value)
|
|
686
|
-
|
|
691
|
+
if additional_bytes is not None:
|
|
692
|
+
txdata += additional_bytes
|
|
693
|
+
ret = self.send_modbus_request(XCONF.UxbusReg.TGPIO_W16B, txdata, 7 + len(additional_bytes))
|
|
694
|
+
else:
|
|
695
|
+
ret = self.send_modbus_request(XCONF.UxbusReg.TGPIO_W16B, txdata, 7)
|
|
687
696
|
if ret == -1:
|
|
688
697
|
return [XCONF.UxbusState.ERR_NOTTCP] * (7 + 1)
|
|
689
698
|
|
|
@@ -726,13 +735,15 @@ class UxbusCmd(object):
|
|
|
726
735
|
|
|
727
736
|
def tgpio_get_digital(self):
|
|
728
737
|
ret = self.tgpio_addr_r16(XCONF.ServoConf.DIGITAL_IN)
|
|
729
|
-
value = [0] *
|
|
738
|
+
value = [0] * 5
|
|
730
739
|
value[0] = ret[0]
|
|
731
740
|
value[1] = ret[1] & 0x0001
|
|
732
741
|
value[2] = (ret[1] & 0x0002) >> 1
|
|
742
|
+
value[3] = (ret[1] & 0x0004) >> 2
|
|
743
|
+
value[4] = (ret[1] & 0x0008) >> 3
|
|
733
744
|
return value
|
|
734
745
|
|
|
735
|
-
def tgpio_set_digital(self, ionum, value):
|
|
746
|
+
def tgpio_set_digital(self, ionum, value, sync=None):
|
|
736
747
|
tmp = 0
|
|
737
748
|
if ionum == 1:
|
|
738
749
|
tmp = tmp | 0x0100
|
|
@@ -742,9 +753,24 @@ class UxbusCmd(object):
|
|
|
742
753
|
tmp = tmp | 0x0200
|
|
743
754
|
if value:
|
|
744
755
|
tmp = tmp | 0x0002
|
|
756
|
+
elif ionum == 3:
|
|
757
|
+
tmp = tmp | 0x1000
|
|
758
|
+
if value:
|
|
759
|
+
tmp = tmp | 0x0010
|
|
760
|
+
elif ionum == 4:
|
|
761
|
+
tmp = tmp | 0x0400
|
|
762
|
+
if value:
|
|
763
|
+
tmp = tmp | 0x0004
|
|
764
|
+
elif ionum == 5:
|
|
765
|
+
tmp = tmp | 0x0800
|
|
766
|
+
if value:
|
|
767
|
+
tmp = tmp | 0x0008
|
|
745
768
|
else:
|
|
746
769
|
return [-1, -1]
|
|
747
|
-
|
|
770
|
+
if sync is not None:
|
|
771
|
+
return self.tgpio_addr_w16(XCONF.ServoConf.DIGITAL_OUT, tmp, additional_bytes=bytes([sync]))
|
|
772
|
+
else:
|
|
773
|
+
return self.tgpio_addr_w16(XCONF.ServoConf.DIGITAL_OUT, tmp)
|
|
748
774
|
|
|
749
775
|
def tgpio_get_analog1(self):
|
|
750
776
|
ret = self.tgpio_addr_r16(XCONF.ServoConf.ANALOG_IO1)
|
|
@@ -1000,30 +1026,39 @@ class UxbusCmd(object):
|
|
|
1000
1026
|
value[1] = ret[1] * 10.0 / 4095.0
|
|
1001
1027
|
return value
|
|
1002
1028
|
|
|
1003
|
-
def cgpio_set_auxdigit(self, ionum, value):
|
|
1029
|
+
def cgpio_set_auxdigit(self, ionum, value, sync=None):
|
|
1004
1030
|
tmp = [0] * 2
|
|
1005
1031
|
if ionum > 7:
|
|
1006
1032
|
tmp[1] = tmp[1] | (0x0100 << (ionum - 8))
|
|
1007
1033
|
if value:
|
|
1008
1034
|
tmp[1] = tmp[1] | (0x0001 << (ionum - 8))
|
|
1035
|
+
if sync is not None:
|
|
1036
|
+
return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_DIGIT, tmp, 2, additional_bytes=bytes([sync]))
|
|
1037
|
+
else:
|
|
1038
|
+
return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_DIGIT, tmp, 2)
|
|
1009
1039
|
else:
|
|
1010
1040
|
tmp[0] = tmp[0] | (0x0100 << ionum)
|
|
1011
1041
|
if value:
|
|
1012
1042
|
tmp[0] = tmp[0] | (0x0001 << ionum)
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
#
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
def cgpio_set_analog1(self, value):
|
|
1043
|
+
if sync is not None:
|
|
1044
|
+
return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_DIGIT, tmp, 1, additional_bytes=bytes([sync]))
|
|
1045
|
+
else:
|
|
1046
|
+
return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_DIGIT, tmp, 1)
|
|
1047
|
+
# return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_DIGIT, tmp, 2 if ionum > 7 else 1)
|
|
1048
|
+
|
|
1049
|
+
def cgpio_set_analog1(self, value, sync=None):
|
|
1021
1050
|
txdata = [int(value / 10.0 * 4095.0)]
|
|
1022
|
-
|
|
1051
|
+
if sync is not None:
|
|
1052
|
+
return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_ANALOG1, txdata, 1, additional_bytes=bytes([sync]))
|
|
1053
|
+
else:
|
|
1054
|
+
return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_ANALOG1, txdata, 1)
|
|
1023
1055
|
|
|
1024
|
-
def cgpio_set_analog2(self, value):
|
|
1056
|
+
def cgpio_set_analog2(self, value, sync=None):
|
|
1025
1057
|
txdata = [int(value / 10.0 * 4095.0)]
|
|
1026
|
-
|
|
1058
|
+
if sync is not None:
|
|
1059
|
+
return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_ANALOG2, txdata, 1, additional_bytes=bytes([sync]))
|
|
1060
|
+
else:
|
|
1061
|
+
return self.set_nu16(XCONF.UxbusReg.CGPIO_SET_ANALOG2, txdata, 1)
|
|
1027
1062
|
|
|
1028
1063
|
def cgpio_set_infun(self, num, fun):
|
|
1029
1064
|
txdata = [int(num), int(fun)]
|
|
@@ -1212,21 +1247,27 @@ class UxbusCmd(object):
|
|
|
1212
1247
|
]
|
|
1213
1248
|
return ret
|
|
1214
1249
|
|
|
1215
|
-
@lock_require
|
|
1216
1250
|
def ft_sensor_get_error(self):
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
return [XCONF.UxbusState.ERR_NOTTCP] * (7 + 1)
|
|
1251
|
+
ret = self.servo_addr_r16(8, 0x0010)
|
|
1252
|
+
if ret[0] in [0, 1, 2] and len(ret) > 1 and ret[1] == 27:
|
|
1253
|
+
ret[0] = 0
|
|
1254
|
+
return ret
|
|
1222
1255
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1256
|
+
# @lock_require
|
|
1257
|
+
# def ft_sensor_get_error(self):
|
|
1258
|
+
# txdata = bytes([8])
|
|
1259
|
+
# txdata += convert.u16_to_bytes(0x0010)
|
|
1260
|
+
# ret = self.send_modbus_request(XCONF.UxbusReg.SERVO_R16B, txdata, 3)
|
|
1261
|
+
# if ret == -1:
|
|
1262
|
+
# return [XCONF.UxbusState.ERR_NOTTCP] * (7 + 1)
|
|
1263
|
+
|
|
1264
|
+
# ret = self.recv_modbus_response(XCONF.UxbusReg.SERVO_R16B, ret, 4, self._G_TOUT)
|
|
1265
|
+
# if ret[0] in [0, 1, 2]:
|
|
1266
|
+
# if convert.bytes_to_long_big(ret[1:5]) == 27:
|
|
1267
|
+
# return [ret[0], 0]
|
|
1268
|
+
# else:
|
|
1269
|
+
# return [ret[0], ret[3]]
|
|
1270
|
+
# return [ret[0], 0]
|
|
1230
1271
|
|
|
1231
1272
|
def cali_tcp_pose(self, four_pnts):
|
|
1232
1273
|
txdata = []
|
|
@@ -1351,3 +1392,61 @@ class UxbusCmd(object):
|
|
|
1351
1392
|
if ret == -1:
|
|
1352
1393
|
return [XCONF.UxbusState.ERR_NOTTCP]
|
|
1353
1394
|
return self.recv_modbus_response(unit_id, ret, -1, timeout, t_prot_id=prot_id, ret_raw=True)
|
|
1395
|
+
|
|
1396
|
+
def set_common_param(self, param_type, param_val):
|
|
1397
|
+
txdata = bytes([param_type])
|
|
1398
|
+
if param_type == 1:
|
|
1399
|
+
txdata += convert.fp32_to_bytes(param_val)
|
|
1400
|
+
else:
|
|
1401
|
+
txdata += convert.int32_to_bytes(param_val)
|
|
1402
|
+
return self.set_nu8(XCONF.UxbusReg.SET_COMMON_PARAM, txdata, 5)
|
|
1403
|
+
|
|
1404
|
+
def get_common_param(self, param_type):
|
|
1405
|
+
txdata = bytes([param_type])
|
|
1406
|
+
ret = self.getset_nu8(XCONF.UxbusReg.GET_COMMON_PARAM, txdata, 1, -1)
|
|
1407
|
+
data = [0] * 2
|
|
1408
|
+
data[0] = ret[0]
|
|
1409
|
+
if ret[0] != XCONF.UxbusState.ERR_NOTTCP:
|
|
1410
|
+
if param_type == 1:
|
|
1411
|
+
data[1] = convert.bytes_to_fp32(ret[1:])
|
|
1412
|
+
else:
|
|
1413
|
+
data[1] = convert.bytes_to_u32(ret[1:])
|
|
1414
|
+
return data
|
|
1415
|
+
|
|
1416
|
+
def get_common_info(self, param_type):
|
|
1417
|
+
txdata = bytes([param_type])
|
|
1418
|
+
ret = self.getset_nu8(XCONF.UxbusReg.GET_COMMON_INFO, txdata, 1, -1)
|
|
1419
|
+
data = [0] * 2
|
|
1420
|
+
data[0] = ret[0]
|
|
1421
|
+
if ret[0] != XCONF.UxbusState.ERR_NOTTCP:
|
|
1422
|
+
if param_type == 1 or param_type == 2:
|
|
1423
|
+
data[1] = ret[1]
|
|
1424
|
+
elif param_type == 50:
|
|
1425
|
+
data[1] = convert.bytes_to_fp32(ret[1:])
|
|
1426
|
+
elif param_type == 101:
|
|
1427
|
+
data[1] = ret[1]
|
|
1428
|
+
data.append(convert.bytes_to_fp32(ret[2:6]))
|
|
1429
|
+
data.append(convert.bytes_to_fp32(ret[6:10]))
|
|
1430
|
+
elif param_type in [102, 104]:
|
|
1431
|
+
data[1] = ret[1]
|
|
1432
|
+
data.append(convert.bytes_to_fp32(ret[2:]))
|
|
1433
|
+
elif param_type == 105:
|
|
1434
|
+
data[1] = convert.bytes_to_fp32(ret[1:])
|
|
1435
|
+
data.append(convert.bytes_to_fp32(ret[5:]))
|
|
1436
|
+
elif param_type in [103, 106]:
|
|
1437
|
+
data[1] = ret[1]
|
|
1438
|
+
data.extend(convert.bytes_to_fp32s(ret[2:], 7))
|
|
1439
|
+
else:
|
|
1440
|
+
data[0] = XCONF.UxbusState.ERR_PARAM
|
|
1441
|
+
return data
|
|
1442
|
+
|
|
1443
|
+
def get_traj_speeding(self, rate):
|
|
1444
|
+
txdata = bytes([rate])
|
|
1445
|
+
ret = self.getset_nu8(XCONF.UxbusReg.GET_TRAJ_SPEEDING, txdata, 1, -1)
|
|
1446
|
+
data = [0] * 4
|
|
1447
|
+
data[0] = ret[0]
|
|
1448
|
+
if ret[0] != XCONF.UxbusState.ERR_NOTTCP:
|
|
1449
|
+
data[1] = convert.bytes_to_int32(ret[1:5])
|
|
1450
|
+
data[2] = convert.bytes_to_int32(ret[5:9])
|
|
1451
|
+
data[3] = round(math.degrees(convert.bytes_to_fp32(ret[9:])),3)
|
|
1452
|
+
return data
|
|
@@ -139,6 +139,7 @@ class UxbusCmdTcp(UxbusCmd):
|
|
|
139
139
|
ret[i + 1] = rx_data[i + 8]
|
|
140
140
|
else:
|
|
141
141
|
# Standard Modbus TCP Protocol
|
|
142
|
+
ret[0] = 0
|
|
142
143
|
num = convert.bytes_to_u16(rx_data[4:6]) + 6
|
|
143
144
|
ret = ret[:num + 1] if len(ret) >= num + 1 else [ret[0]] * (num + 1)
|
|
144
145
|
length = len(rx_data)
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#
|
|
7
7
|
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
|
|
8
8
|
|
|
9
|
+
import re
|
|
9
10
|
from ._blockly_node import _BlocklyNode
|
|
10
11
|
|
|
11
12
|
OPS_MAP = {
|
|
@@ -188,6 +189,40 @@ class _BlocklyBase(_BlocklyNode):
|
|
|
188
189
|
values.append(int(field.text))
|
|
189
190
|
timeout = float(fields[-1].text)
|
|
190
191
|
return 'self._arm.arm.get_tgpio_li_state({}, timeout={})'.format(values, timeout)
|
|
192
|
+
elif block.attrib['type'] == 'get_modbus_rtu':
|
|
193
|
+
fields = self._get_nodes('field', root=block)
|
|
194
|
+
host_id = fields[0].text
|
|
195
|
+
cmd = fields[1].text
|
|
196
|
+
cmd_li = re.sub(',', ' ', cmd)
|
|
197
|
+
is_run_cmd = ''.join(cmd_li.split()).isalnum()
|
|
198
|
+
if not is_run_cmd:
|
|
199
|
+
self._append_main_code('-1', indent + 2)
|
|
200
|
+
cmd_li = re.sub(' +', ' ', cmd_li)
|
|
201
|
+
cmd_li = re.sub('\xa0', ' ', cmd_li)
|
|
202
|
+
cmd_li = re.sub('\s+', ' ', cmd_li)
|
|
203
|
+
cmd_li = cmd_li.strip().split(' ')
|
|
204
|
+
int_li = [int(da, 16) for da in cmd_li]
|
|
205
|
+
return '[" ".join([hex(da).split("0x")[1].upper().zfill(2) for da in data]) if isinstance(data, list) else data for ' \
|
|
206
|
+
'data in self._arm.getset_tgpio_modbus_data({}, host_id={})][-1]'.format(int_li, host_id)
|
|
207
|
+
elif block.attrib['type'] == 'get_gripper_status':
|
|
208
|
+
fields = self._get_nodes('field', root=block)
|
|
209
|
+
timeout = fields[0].text
|
|
210
|
+
return '0 == self._arm.arm.check_catch_gripper_status({})'.format(timeout)
|
|
211
|
+
elif block.attrib['type'] == 'get_ft_sensor':
|
|
212
|
+
direction_li = ['Fx', 'Fy', 'Fz', 'Tx', 'Ty', 'Tz']
|
|
213
|
+
fields = self._get_nodes('field', root=block)
|
|
214
|
+
direction = fields[0].text
|
|
215
|
+
return '[self._arm.ft_sensor_enable(1), self._arm.set_state(0), self._arm.get_ft_sensor_data()[1][{}]][2] if' \
|
|
216
|
+
' self._arm.get_ft_sensor_config()[1][1] == 0 else self._arm.get_ft_sensor_data()[1][{}]'.\
|
|
217
|
+
format(direction_li.index(direction), direction_li.index(direction))
|
|
218
|
+
elif block.attrib['type'] == 'get_counter':
|
|
219
|
+
return 'self._arm.count'
|
|
220
|
+
elif block.attrib['type'] == 'get_single_holding_register':
|
|
221
|
+
fields = self._get_nodes('field', root=block)
|
|
222
|
+
addr = int(fields[0].text.replace(' ', '').replace('0x', '').replace(',', '').replace('\xa0', ''), 16)
|
|
223
|
+
return "list(map(lambda x: hex(x).split('0x')[1].upper().zfill(4)[:2] + ' ' + hex(x).split('0x')[1]." \
|
|
224
|
+
"upper().zfill(4)[2:], self._arm.read_holding_registers({}, 1)[1]))[0]".format(str(addr))
|
|
225
|
+
|
|
191
226
|
|
|
192
227
|
def __get_logic_compare(self, block, arg_map=None):
|
|
193
228
|
op = OPS_MAP.get(self._get_node('field', block).text)
|
|
@@ -198,7 +233,7 @@ class _BlocklyBase(_BlocklyNode):
|
|
|
198
233
|
cond_a = self._get_condition_expression(values[0], arg_map=arg_map)
|
|
199
234
|
if len(values) > 1:
|
|
200
235
|
cond_b = self._get_condition_expression(values[1], arg_map=arg_map)
|
|
201
|
-
return '{} {} {}'.format(cond_a, op, cond_b)
|
|
236
|
+
return '({}) {} ({})'.format(cond_a, op, cond_b)
|
|
202
237
|
|
|
203
238
|
def __get_logic_operation(self, block, arg_map=None):
|
|
204
239
|
op = self._get_node('field', block).text.lower()
|
|
@@ -209,7 +244,7 @@ class _BlocklyBase(_BlocklyNode):
|
|
|
209
244
|
cond_a = self._get_condition_expression(values[0], arg_map=arg_map)
|
|
210
245
|
if len(values) > 1:
|
|
211
246
|
cond_b = self._get_condition_expression(values[1], arg_map=arg_map)
|
|
212
|
-
return '{} {} {}'.format(cond_a, op, cond_b)
|
|
247
|
+
return '({}) {} ({})'.format(cond_a, op, cond_b)
|
|
213
248
|
|
|
214
249
|
def __get_math_arithmetic(self, block, arg_map=None):
|
|
215
250
|
field = self._get_node('field', block).text
|