dora-piper 0.3.6__tar.gz → 0.3.9__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.
Potentially problematic release.
This version of dora-piper might be problematic. Click here for more details.
- dora_piper-0.3.9/PKG-INFO +21 -0
- {dora_piper-0.3.6 → dora_piper-0.3.9}/dora_piper/__init__.py +1 -1
- {dora_piper-0.3.6 → dora_piper-0.3.9}/dora_piper/main.py +81 -36
- dora_piper-0.3.9/dora_piper.egg-info/PKG-INFO +21 -0
- dora_piper-0.3.9/dora_piper.egg-info/SOURCES.txt +11 -0
- dora_piper-0.3.9/dora_piper.egg-info/dependency_links.txt +1 -0
- dora_piper-0.3.9/dora_piper.egg-info/entry_points.txt +2 -0
- dora_piper-0.3.9/dora_piper.egg-info/requires.txt +3 -0
- dora_piper-0.3.9/dora_piper.egg-info/top_level.txt +1 -0
- dora_piper-0.3.9/pyproject.toml +16 -0
- dora_piper-0.3.9/setup.cfg +4 -0
- dora_piper-0.3.9/tests/test_piper.py +5 -0
- dora_piper-0.3.6/PKG-INFO +0 -29
- dora_piper-0.3.6/pyproject.toml +0 -21
- {dora_piper-0.3.6 → dora_piper-0.3.9}/README.md +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: dora-piper
|
|
3
|
+
Version: 0.3.9
|
|
4
|
+
Summary: Dora Node for using Agilex piper
|
|
5
|
+
Author-email: Haixuan Xavier Tao <tao.xavier@outlook.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: dora-rs>=0.3.6
|
|
10
|
+
Requires-Dist: piper_sdk>=0.0.8
|
|
11
|
+
Requires-Dist: numpy<2.0.0
|
|
12
|
+
|
|
13
|
+
# Dora Node (Experimental) to communicate with Agilex Piper SDK
|
|
14
|
+
|
|
15
|
+
This node is used to communicate with piper.
|
|
16
|
+
|
|
17
|
+
Make sure to follow both the setup script and installation script from https://github.com/agilexrobotics/piper_sdk
|
|
18
|
+
|
|
19
|
+
# To setup the arm
|
|
20
|
+
|
|
21
|
+
Make sure that the can bus is activated for both arm and leader arms are not connected.
|
|
@@ -5,7 +5,7 @@ readme_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "README.m
|
|
|
5
5
|
|
|
6
6
|
# Read the content of the README file
|
|
7
7
|
try:
|
|
8
|
-
with open(readme_path,
|
|
8
|
+
with open(readme_path, encoding="utf-8") as f:
|
|
9
9
|
__doc__ = f.read()
|
|
10
10
|
except FileNotFoundError:
|
|
11
11
|
__doc__ = "README file not found."
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
from piper_sdk import C_PiperInterface
|
|
2
|
-
from dora import Node
|
|
3
|
-
import pyarrow as pa
|
|
4
1
|
import os
|
|
5
2
|
import time
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import numpy as np
|
|
5
|
+
import pyarrow as pa
|
|
6
|
+
from dora import Node
|
|
7
|
+
from piper_sdk import C_PiperInterface
|
|
8
|
+
|
|
9
|
+
TEACH_MODE = os.getenv("TEACH_MODE", "False") in ["True", "true"]
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
def enable_fun(piper: C_PiperInterface):
|
|
14
|
-
"""
|
|
15
|
-
使能机械臂并检测使能状态,尝试5s,如果使能超时则退出程序
|
|
13
|
+
"""使能机械臂并检测使能状态,尝试5s,如果使能超时则退出程序
|
|
16
14
|
"""
|
|
17
15
|
enable_flag = False
|
|
18
16
|
# 设置超时时间(秒)
|
|
@@ -32,8 +30,6 @@ def enable_fun(piper: C_PiperInterface):
|
|
|
32
30
|
and piper.GetArmLowSpdInfoMsgs().motor_6.foc_status.driver_enable_status
|
|
33
31
|
)
|
|
34
32
|
print("使能状态:", enable_flag)
|
|
35
|
-
piper.EnableArm(7)
|
|
36
|
-
piper.GripperCtrl(0, 1000, 0x01, 0)
|
|
37
33
|
print("--------------------")
|
|
38
34
|
# 检查是否超过超时时间
|
|
39
35
|
if elapsed_time > timeout:
|
|
@@ -44,8 +40,7 @@ def enable_fun(piper: C_PiperInterface):
|
|
|
44
40
|
time.sleep(1)
|
|
45
41
|
if elapsed_time_flag:
|
|
46
42
|
print("程序自动使能超时,退出程序")
|
|
47
|
-
|
|
48
|
-
exit(0)
|
|
43
|
+
raise ConnectionError("程序自动使能超时,退出程序")
|
|
49
44
|
|
|
50
45
|
|
|
51
46
|
def main():
|
|
@@ -54,35 +49,25 @@ def main():
|
|
|
54
49
|
piper = C_PiperInterface(CAN_BUS)
|
|
55
50
|
piper.ConnectPort()
|
|
56
51
|
|
|
57
|
-
if TEACH_MODE
|
|
52
|
+
if not TEACH_MODE:
|
|
58
53
|
# piper.MotionCtrl_3(0, 0, 0, 0x00)#位置速度模式
|
|
59
54
|
piper.EnableArm(7)
|
|
60
55
|
enable_fun(piper=piper)
|
|
61
|
-
piper.
|
|
56
|
+
piper.MotionCtrl_2(0x01, 0x01, 50, 0x00)
|
|
57
|
+
piper.JointCtrl(0, 0, 0, 0, 0, 0)
|
|
58
|
+
piper.GripperCtrl(abs(0), 1000, 0x01, 0)
|
|
59
|
+
piper.MotionCtrl_2(0x01, 0x01, 50, 0x00)
|
|
60
|
+
time.sleep(5)
|
|
61
|
+
|
|
62
62
|
factor = 57324.840764 # 1000*180/3.14
|
|
63
|
-
time.sleep(2)
|
|
64
63
|
node = Node()
|
|
65
64
|
|
|
66
65
|
for event in node:
|
|
67
66
|
if event["type"] == "INPUT":
|
|
68
|
-
if event["id"]
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
joint_value = []
|
|
73
|
-
joint_value += [joint.joint_state.joint_1.real / factor]
|
|
74
|
-
joint_value += [joint.joint_state.joint_2.real / factor]
|
|
75
|
-
joint_value += [joint.joint_state.joint_3.real / factor]
|
|
76
|
-
joint_value += [joint.joint_state.joint_4.real / factor]
|
|
77
|
-
joint_value += [joint.joint_state.joint_5.real / factor]
|
|
78
|
-
joint_value += [joint.joint_state.joint_6.real / factor]
|
|
79
|
-
joint_value += [gripper.gripper_state.grippers_angle / 1000 / 1000 / 4]
|
|
80
|
-
|
|
81
|
-
node.send_output("jointstate", pa.array(joint_value, type=pa.float32()))
|
|
82
|
-
else:
|
|
83
|
-
|
|
67
|
+
if event["id"] == "joint_action":
|
|
68
|
+
if TEACH_MODE:
|
|
69
|
+
continue
|
|
84
70
|
# Do not push to many commands to fast. Limiting it to 20Hz
|
|
85
|
-
# This is due to writing on a moving arm might fail the can bus.
|
|
86
71
|
if time.time() - elapsed_time > 0.05:
|
|
87
72
|
elapsed_time = time.time()
|
|
88
73
|
else:
|
|
@@ -95,15 +80,75 @@ def main():
|
|
|
95
80
|
joint_3 = round(position[3] * factor)
|
|
96
81
|
joint_4 = round(position[4] * factor)
|
|
97
82
|
joint_5 = round(position[5] * factor)
|
|
98
|
-
joint_6 = round(position[6] * 1000 *
|
|
83
|
+
joint_6 = round(position[6] * 1000 * 100)
|
|
99
84
|
|
|
100
85
|
piper.MotionCtrl_2(0x01, 0x01, 50, 0x00)
|
|
101
86
|
piper.JointCtrl(joint_0, joint_1, joint_2, joint_3, joint_4, joint_5)
|
|
102
87
|
piper.GripperCtrl(abs(joint_6), 1000, 0x01, 0)
|
|
103
88
|
piper.MotionCtrl_2(0x01, 0x01, 50, 0x00)
|
|
104
|
-
elif event["type"] == "STOP":
|
|
105
89
|
|
|
106
|
-
|
|
90
|
+
elif event["id"] == "eef_action":
|
|
91
|
+
if TEACH_MODE:
|
|
92
|
+
continue
|
|
93
|
+
# Do not push to many commands to fast. Limiting it to 20Hz
|
|
94
|
+
if time.time() - elapsed_time > 0.05:
|
|
95
|
+
elapsed_time = time.time()
|
|
96
|
+
else:
|
|
97
|
+
continue
|
|
98
|
+
|
|
99
|
+
position = event["value"].to_numpy()
|
|
100
|
+
piper.MotionCtrl_2(0x01, 0x01, 50, 0x00)
|
|
101
|
+
piper.EndPoseCtrl(
|
|
102
|
+
position[0] * 1000 * 1000,
|
|
103
|
+
position[1] * 1000 * 1000,
|
|
104
|
+
position[2] * 1000 * 1000,
|
|
105
|
+
position[3] * 1000 / (2 * np.pi) * 360,
|
|
106
|
+
position[4] * 1000 / (2 * np.pi) * 360,
|
|
107
|
+
position[5] * 1000 / (2 * np.pi) * 360,
|
|
108
|
+
)
|
|
109
|
+
piper.GripperCtrl(abs(position[6] * 1000 * 100), 1000, 0x01, 0)
|
|
110
|
+
piper.MotionCtrl_2(0x01, 0x01, 50, 0x00)
|
|
111
|
+
|
|
112
|
+
else:
|
|
113
|
+
joint = piper.GetArmJointMsgs()
|
|
114
|
+
|
|
115
|
+
joint_value = []
|
|
116
|
+
joint_value += [joint.joint_state.joint_1.real / factor]
|
|
117
|
+
joint_value += [joint.joint_state.joint_2.real / factor]
|
|
118
|
+
joint_value += [joint.joint_state.joint_3.real / factor]
|
|
119
|
+
joint_value += [joint.joint_state.joint_4.real / factor]
|
|
120
|
+
joint_value += [joint.joint_state.joint_5.real / factor]
|
|
121
|
+
joint_value += [joint.joint_state.joint_6.real / factor]
|
|
122
|
+
|
|
123
|
+
gripper = piper.GetArmGripperMsgs()
|
|
124
|
+
joint_value += [gripper.gripper_state.grippers_angle / 1000 / 100]
|
|
125
|
+
|
|
126
|
+
node.send_output("jointstate", pa.array(joint_value, type=pa.float32()))
|
|
127
|
+
|
|
128
|
+
position = piper.GetArmEndPoseMsgs()
|
|
129
|
+
position_value = []
|
|
130
|
+
position_value += [position.end_pose.X_axis * 0.001 * 0.001]
|
|
131
|
+
position_value += [position.end_pose.Y_axis * 0.001 * 0.001]
|
|
132
|
+
position_value += [position.end_pose.Z_axis * 0.001 * 0.001]
|
|
133
|
+
position_value += [position.end_pose.RX_axis * 0.001 / 360 * 2 * np.pi]
|
|
134
|
+
position_value += [position.end_pose.RY_axis * 0.001 / 360 * 2 * np.pi]
|
|
135
|
+
position_value += [position.end_pose.RZ_axis * 0.001 / 360 * 2 * np.pi]
|
|
136
|
+
|
|
137
|
+
node.send_output("pose", pa.array(position_value, type=pa.float32()))
|
|
138
|
+
node.send_output(
|
|
139
|
+
"gripper",
|
|
140
|
+
pa.array(
|
|
141
|
+
[gripper.gripper_state.grippers_angle / 1000 / 100],
|
|
142
|
+
type=pa.float32(),
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
elif event["type"] == "STOP":
|
|
147
|
+
if not TEACH_MODE:
|
|
148
|
+
piper.MotionCtrl_2(0x01, 0x01, 50, 0x00)
|
|
149
|
+
piper.JointCtrl(0, 0, 0, 0, 0, 0)
|
|
150
|
+
piper.GripperCtrl(abs(0), 1000, 0x01, 0)
|
|
151
|
+
piper.MotionCtrl_2(0x01, 0x01, 50, 0x00)
|
|
107
152
|
time.sleep(5)
|
|
108
153
|
break
|
|
109
154
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: dora-piper
|
|
3
|
+
Version: 0.3.9
|
|
4
|
+
Summary: Dora Node for using Agilex piper
|
|
5
|
+
Author-email: Haixuan Xavier Tao <tao.xavier@outlook.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: dora-rs>=0.3.6
|
|
10
|
+
Requires-Dist: piper_sdk>=0.0.8
|
|
11
|
+
Requires-Dist: numpy<2.0.0
|
|
12
|
+
|
|
13
|
+
# Dora Node (Experimental) to communicate with Agilex Piper SDK
|
|
14
|
+
|
|
15
|
+
This node is used to communicate with piper.
|
|
16
|
+
|
|
17
|
+
Make sure to follow both the setup script and installation script from https://github.com/agilexrobotics/piper_sdk
|
|
18
|
+
|
|
19
|
+
# To setup the arm
|
|
20
|
+
|
|
21
|
+
Make sure that the can bus is activated for both arm and leader arms are not connected.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
dora_piper/__init__.py
|
|
4
|
+
dora_piper/main.py
|
|
5
|
+
dora_piper.egg-info/PKG-INFO
|
|
6
|
+
dora_piper.egg-info/SOURCES.txt
|
|
7
|
+
dora_piper.egg-info/dependency_links.txt
|
|
8
|
+
dora_piper.egg-info/entry_points.txt
|
|
9
|
+
dora_piper.egg-info/requires.txt
|
|
10
|
+
dora_piper.egg-info/top_level.txt
|
|
11
|
+
tests/test_piper.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dora_piper
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dora-piper"
|
|
3
|
+
version = "0.3.9"
|
|
4
|
+
authors = [{ name = "Haixuan Xavier Tao", email = "tao.xavier@outlook.com" }]
|
|
5
|
+
description = "Dora Node for using Agilex piper"
|
|
6
|
+
license = { text = "MIT" }
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.8"
|
|
9
|
+
|
|
10
|
+
dependencies = ["dora-rs >= 0.3.6", "piper_sdk >= 0.0.8", "numpy < 2.0.0"]
|
|
11
|
+
|
|
12
|
+
[dependency-groups]
|
|
13
|
+
dev = ["pytest >=8.1.1", "ruff >=0.9.1"]
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
dora-piper = "dora_piper.main:main"
|
dora_piper-0.3.6/PKG-INFO
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: dora-piper
|
|
3
|
-
Version: 0.3.6
|
|
4
|
-
Summary: Dora Node for using Agilex piper
|
|
5
|
-
Author: Haixuan Xavier Tao
|
|
6
|
-
Author-email: tao.xavier@outlook.com
|
|
7
|
-
Requires-Python: >=3.7,<4.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Requires-Dist: dora-rs (>=0.3.6,<0.4.0)
|
|
17
|
-
Requires-Dist: piper_sdk (>=0.0.7,<0.0.8)
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
|
-
# Dora Node (Experimental) to communicate with Agilex Piper SDK
|
|
21
|
-
|
|
22
|
-
This node is used to communicate with piper.
|
|
23
|
-
|
|
24
|
-
Make sure to follow both the setup script and installation script from https://github.com/agilexrobotics/piper_sdk
|
|
25
|
-
|
|
26
|
-
# To setup the arm
|
|
27
|
-
|
|
28
|
-
Make sure that the can bus is activated for both arm and leader arms are not connected.
|
|
29
|
-
|
dora_piper-0.3.6/pyproject.toml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
[tool.poetry]
|
|
2
|
-
name = "dora-piper"
|
|
3
|
-
version = "0.3.6"
|
|
4
|
-
authors = ["Haixuan Xavier Tao <tao.xavier@outlook.com>"]
|
|
5
|
-
description = "Dora Node for using Agilex piper"
|
|
6
|
-
readme = "README.md"
|
|
7
|
-
|
|
8
|
-
packages = [{ include = "dora_piper" }]
|
|
9
|
-
|
|
10
|
-
[tool.poetry.dependencies]
|
|
11
|
-
dora-rs = "^0.3.6"
|
|
12
|
-
python = "^3.7"
|
|
13
|
-
piper_sdk = "^0.0.7"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[tool.poetry.scripts]
|
|
17
|
-
dora-piper = "dora_piper.main:main"
|
|
18
|
-
|
|
19
|
-
[build-system]
|
|
20
|
-
requires = ["poetry-core>=1.8.0"]
|
|
21
|
-
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|