kuavo-humanoid-sdk 0.1.1__tar.gz → 1.1.2a692__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 kuavo-humanoid-sdk might be problematic. Click here for more details.
- kuavo_humanoid_sdk-1.1.2a692/PKG-INFO +271 -0
- kuavo_humanoid_sdk-1.1.2a692/README.md +78 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/__init__.py +1 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/interfaces/data_types.py +30 -7
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/interfaces/end_effector.py +23 -4
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/__init__.py +1 -1
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/core.py +21 -13
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/dex_hand_control.py +44 -15
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/ros/control.py +72 -16
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/ros/param.py +6 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/ros/state.py +88 -33
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/ros_env.py +48 -10
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/dexterous_hand.py +40 -25
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/leju_claw.py +24 -17
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/robot.py +42 -15
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/robot_arm.py +6 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/robot_info.py +1 -0
- kuavo_humanoid_sdk-1.1.2a692/kuavo_humanoid_sdk.egg-info/PKG-INFO +271 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/setup.py +10 -1
- kuavo_humanoid_sdk-0.1.1/PKG-INFO +0 -213
- kuavo_humanoid_sdk-0.1.1/README.md +0 -67
- kuavo_humanoid_sdk-0.1.1/kuavo_humanoid_sdk.egg-info/PKG-INFO +0 -213
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/common/logger.py +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/interfaces/__init__.py +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/interfaces/robot.py +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/interfaces/robot_info.py +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/leju_claw_control.py +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/ros/sat_utils.py +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/robot_head.py +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/robot_state.py +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk.egg-info/SOURCES.txt +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk.egg-info/dependency_links.txt +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk.egg-info/requires.txt +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk.egg-info/top_level.txt +0 -0
- {kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/setup.cfg +0 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: kuavo_humanoid_sdk
|
|
3
|
+
Version: 1.1.2a692
|
|
4
|
+
Summary: A Python SDK for kuavo humanoid robot.
|
|
5
|
+
Home-page: https://gitee.com/leju-robot/kuavo-ros-opensource/
|
|
6
|
+
Author: ['lejurobot']
|
|
7
|
+
Author-email: ['edu@lejurobot.com']
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://gitee.com/leju-robot/kuavo-ros-opensource/
|
|
10
|
+
Project-URL: Source Code, https://gitee.com/leju-robot/kuavo-ros-opensource/
|
|
11
|
+
Keywords: kuavo,humanoid,robot,robotics,lejurobot,ros
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# Kuavo Humanoid SDK
|
|
25
|
+
|
|
26
|
+
A comprehensive Python SDK for controlling Kuavo humanoid robots. This SDK provides interfaces for robot state management, arm and head control, and end-effector operations. It is designed to work with ROS (Robot Operating System) environments.
|
|
27
|
+
|
|
28
|
+
**Warning**: This SDK currently only supports **ROS1**. ROS2 support is not available.
|
|
29
|
+
|
|
30
|
+
**Warning**: **This SDK can only be used on the onboard NUC computer located in the robot's torso.**
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- Robot State Management
|
|
37
|
+
- IMU data (acceleration, angular velocity, euler angles)
|
|
38
|
+
- Joint/motor states (position, velocity, torque)
|
|
39
|
+
- Torso state (position, orientation, velocity)
|
|
40
|
+
- Odometry information
|
|
41
|
+
- End-effector states:
|
|
42
|
+
- Gripper(lejuclaw): position, velocity, torque, grasp status
|
|
43
|
+
- Dexterous hand(qiangnao): position, velocity, torque
|
|
44
|
+
- Touch Dexterous hand(qiangnao_touch): position, velocity, torque, touch state
|
|
45
|
+
- End-effector position and orientation
|
|
46
|
+
- Motion states: stand, walk, step_control, trot
|
|
47
|
+
|
|
48
|
+
- Motion Control
|
|
49
|
+
- Arm Control
|
|
50
|
+
- Joint position control
|
|
51
|
+
- End-effector 6D control via inverse kinematics
|
|
52
|
+
- Forward kinematics (FK) for computing end-effector pose
|
|
53
|
+
- Keyframe sequence control for complex motions
|
|
54
|
+
- End-effector Control
|
|
55
|
+
- Gripper control (position control with configurable velocity and torque)
|
|
56
|
+
- Dexterous hand control
|
|
57
|
+
- Position control
|
|
58
|
+
- Pre-defined hand gestures (OK, 666, fist, etc.)
|
|
59
|
+
- Head Control
|
|
60
|
+
- Position control
|
|
61
|
+
- Torso Control
|
|
62
|
+
- Height control (squatting)
|
|
63
|
+
- Forward/backward tilt control
|
|
64
|
+
- Dynamic Motion Control
|
|
65
|
+
- Stance
|
|
66
|
+
- Trot
|
|
67
|
+
- Walking (xy and yaw velocity control)
|
|
68
|
+
- Stepping (gait switching)
|
|
69
|
+
|
|
70
|
+
- Robot Basic Information
|
|
71
|
+
- Robot type (kuavo)
|
|
72
|
+
- Robot version
|
|
73
|
+
- End-effector type
|
|
74
|
+
- Joint names
|
|
75
|
+
- Total degrees of freedom (28)
|
|
76
|
+
- Arm degrees of freedom (7 per arm)
|
|
77
|
+
- Head degrees of freedom (2)
|
|
78
|
+
- Leg degrees of freedom (12)
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
**Note: There are currently two versions of this SDK, the stable version and the beta version. Their differences are:**
|
|
83
|
+
|
|
84
|
+
- stable version: corresponding to the functionality provided by the `master` branch of [kuavo-ros-opensource](https://gitee.com/leju-robot/kuavo-ros-opensource/).
|
|
85
|
+
- Beta version: This version is more aggressive than the official version and also provides richer functionality, corresponding to the functionality provided by the `beta` branch of [kuavo-ros-opensource](https://gitee.com/leju-robot/kuavo-ros-opensource/).
|
|
86
|
+
|
|
87
|
+
**Friendly reminder: Please be clear about which version you need to install. If your SDK version does not match `kuavo-ros-opensource`, some features may not be available.**
|
|
88
|
+
|
|
89
|
+
Install the latest **stable version** of Kuavo Humanoid SDK using pip:
|
|
90
|
+
```bash
|
|
91
|
+
pip install kuavo-humanoid-sdk
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Install the latest **beta version** of Kuavo Humanoid SDK using pip:
|
|
95
|
+
```bash
|
|
96
|
+
pip install --pre kuavo-humanoid-sdk
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
For local development installation (editable mode), use:
|
|
100
|
+
```bash
|
|
101
|
+
cd src/kuavo_humanoid_sdk
|
|
102
|
+
chmod +x install.sh
|
|
103
|
+
./install.sh
|
|
104
|
+
```
|
|
105
|
+
## Upgrade Instructions
|
|
106
|
+
Before upgrading, you can check the currently installed version with:
|
|
107
|
+
```bash
|
|
108
|
+
pip show kuavo-humanoid-sdk
|
|
109
|
+
# Output:
|
|
110
|
+
Name: kuavo-humanoid-sdk
|
|
111
|
+
Version: 0.1.2
|
|
112
|
+
...
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Note: If the version number contains the letter b, it indicates a beta version, e.g., Version: 0.1.2b113**
|
|
116
|
+
|
|
117
|
+
To upgrade from a stable version to the latest stable version:
|
|
118
|
+
```bash
|
|
119
|
+
pip install --upgrade kuavo_humanoid_sdk
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
To upgrade from a beta version to the latest stable version:
|
|
123
|
+
```bash
|
|
124
|
+
pip install --upgrade --force-reinstall kuavo_humanoid_sdk
|
|
125
|
+
# or
|
|
126
|
+
pip uninstall kuavo_humanoid_sdk && pip install kuavo_humanoid_sdk
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
To upgrade from a stable/beta version to the latest beta version:
|
|
130
|
+
```bash
|
|
131
|
+
pip install --upgrade --pre kuavo_humanoid_sdk
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Package Information
|
|
135
|
+
|
|
136
|
+
You can check the package information using pip:
|
|
137
|
+
```bash
|
|
138
|
+
pip show kuavo-humanoid-sdk
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Quick Start
|
|
142
|
+
|
|
143
|
+
Here's a simple example to get started with Kuavo Humanoid SDK:
|
|
144
|
+
|
|
145
|
+
> **Warning**: Before running any code, make sure to start the robot first by executing either:
|
|
146
|
+
> - For simulation: `roslaunch humanoid_controllers load_kuavo_mujoco_sim.launch` (Example command)
|
|
147
|
+
> - For real robot: `roslaunch humanoid_controllers load_kuavo_real.launch` (Example command)
|
|
148
|
+
```python3
|
|
149
|
+
# Copyright (c) 2025 Leju Robotics. Licensed under the MIT License.
|
|
150
|
+
import time
|
|
151
|
+
from kuavo_humanoid_sdk import KuavoSDK, KuavoRobot
|
|
152
|
+
|
|
153
|
+
def main():
|
|
154
|
+
if not KuavoSDK().Init(): # Init! !!! IMPORTANT !!!
|
|
155
|
+
print("Init KuavoSDK failed, exit!")
|
|
156
|
+
exit(1)
|
|
157
|
+
robot = KuavoRobot()
|
|
158
|
+
|
|
159
|
+
""" arm reset """
|
|
160
|
+
print("Switching to arm reset mode...")
|
|
161
|
+
robot.arm_reset()
|
|
162
|
+
|
|
163
|
+
""" stance """
|
|
164
|
+
print("Switching to stance mode...")
|
|
165
|
+
robot.stance()
|
|
166
|
+
|
|
167
|
+
""" trot """
|
|
168
|
+
print("Switching to trot mode...")
|
|
169
|
+
robot.trot()
|
|
170
|
+
|
|
171
|
+
""" walk forward """
|
|
172
|
+
print("Starting forward walk...")
|
|
173
|
+
duration = 4.0 # seconds
|
|
174
|
+
speed = 0.3 # m/s
|
|
175
|
+
start_time = time.time()
|
|
176
|
+
while (time.time() - start_time < duration):
|
|
177
|
+
robot.walk(linear_x=speed, linear_y=0.0, angular_z=0.0)
|
|
178
|
+
time.sleep(0.1) # Small sleep to prevent busy loop
|
|
179
|
+
|
|
180
|
+
if __name__ == "__main__":
|
|
181
|
+
main()
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Docs
|
|
185
|
+
The documentation is available in two formats:
|
|
186
|
+
- HTML format: [docs/html](docs/html), **needs to be generated by running the script**
|
|
187
|
+
- Markdown format: [docs/markdown](docs/markdown)
|
|
188
|
+
|
|
189
|
+
We recommend that you generate the documentation locally by running the documentation script. The documentation will be output to the `docs/html` and `docs/markdown` folders:
|
|
190
|
+
```bash
|
|
191
|
+
cd <kuavo-ros-opensource>/src/kuavo_humanoid_sdk
|
|
192
|
+
chmod +x gen_docs.sh
|
|
193
|
+
./gen_docs.sh
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**We recommend that you view the documentation using `html` for a better experience.**
|
|
197
|
+
|
|
198
|
+
For Markdown documentation at:
|
|
199
|
+
|
|
200
|
+
https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/docs/markdown/index.md
|
|
201
|
+
|
|
202
|
+
## Examples
|
|
203
|
+
|
|
204
|
+
#### WARNING
|
|
205
|
+
Before running any code examples, make sure to start the robot first by executing either:
|
|
206
|
+
|
|
207
|
+
- For simulation: `roslaunch humanoid_controllers load_kuavo_mujoco_sim.launch` (Example command)
|
|
208
|
+
- For real robot: `roslaunch humanoid_controllers load_kuavo_real.launch` (Example command)
|
|
209
|
+
|
|
210
|
+
### Robot Info
|
|
211
|
+
|
|
212
|
+
Examples showing how to get basic robot information.
|
|
213
|
+
|
|
214
|
+
[https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/robot_info_example.py](https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/robot_info_example.py)
|
|
215
|
+
|
|
216
|
+
### Basic Robot Control
|
|
217
|
+
|
|
218
|
+
A basic example showing how to initialize the SDK and control the robot’s movement.
|
|
219
|
+
|
|
220
|
+
[https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/motion_example.py](https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/motion_example.py)
|
|
221
|
+
|
|
222
|
+
### End Effector Control
|
|
223
|
+
|
|
224
|
+
#### LejuClaw Gripper
|
|
225
|
+
|
|
226
|
+
Examples demonstrating how to control the LejuClaw gripper end effector, including position, velocity and torque control.
|
|
227
|
+
|
|
228
|
+
[https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/lejuclaw_example.py](https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/lejuclaw_example.py)
|
|
229
|
+
|
|
230
|
+
#### QiangNao DexHand
|
|
231
|
+
|
|
232
|
+
Examples showing how to control the QiangNao DexHand, a dexterous robotic hand with multiple degrees of freedom for complex manipulation tasks.
|
|
233
|
+
|
|
234
|
+
[https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/dexhand_example.py](https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/dexhand_example.py)
|
|
235
|
+
|
|
236
|
+
### Arm Control
|
|
237
|
+
|
|
238
|
+
Examples showing arm trajectory control and target pose control.
|
|
239
|
+
|
|
240
|
+
[https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/ctrl_arm_example.py](https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/ctrl_arm_example.py)
|
|
241
|
+
|
|
242
|
+
### Forward and Inverse Kinematics
|
|
243
|
+
|
|
244
|
+
Examples demonstrating how to use forward kinematics (FK) to compute end-effector positions from joint angles, and inverse kinematics (IK) to calculate joint angles needed to achieve desired end-effector poses.
|
|
245
|
+
|
|
246
|
+
[https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/arm_ik_example.py](https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/arm_ik_example.py)
|
|
247
|
+
|
|
248
|
+
### Head Control
|
|
249
|
+
|
|
250
|
+
Examples showing how to control the robot’s head movements, including nodding (pitch) and shaking (yaw) motions.
|
|
251
|
+
|
|
252
|
+
[https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/ctrl_head_example.py](https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/ctrl_head_example.py)
|
|
253
|
+
|
|
254
|
+
### Step-by-Step Control
|
|
255
|
+
|
|
256
|
+
Examples showing how to control the robot’s movements step by step, including individual foot placement and trajectory control.
|
|
257
|
+
|
|
258
|
+
[https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/step_control_example.py](https://gitee.com/leju-robot/kuavo-ros-opensource/tree/master/src/kuavo_humanoid_sdk/examples/step_control_example.py)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
## License
|
|
262
|
+
|
|
263
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
264
|
+
|
|
265
|
+
## Contact & Support
|
|
266
|
+
|
|
267
|
+
For any questions, support, or bug reports, please contact:
|
|
268
|
+
- Email: edu@lejurobot.com
|
|
269
|
+
- Website: https://gitee.com/leju-robot/kuavo-ros-opensource/
|
|
270
|
+
- Source Code: https://gitee.com/leju-robot/kuavo-ros-opensource/
|
|
271
|
+
- Issue Tracker: https://gitee.com/leju-robot/kuavo-ros-opensource/issues
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Kuavo Humanoid SDK
|
|
2
|
+
[](https://pypi.org/project/kuavo-humanoid-sdk/)[](#)[](https://pypi.python.org/pypi/kuavo-humanoid-sdk)
|
|
3
|
+
|
|
4
|
+
一个全面的 Python SDK,用于控制 Kuavo 人形机器人。该 SDK 提供了机器人状态管理、手臂和头部控制以及末端执行器操作的接口。它设计用于与 ROS(机器人操作系统)环境一起工作。
|
|
5
|
+
|
|
6
|
+
**警告**:该 SDK 目前仅支持 **ROS1**。不支持 ROS2。
|
|
7
|
+
|
|
8
|
+
PyPI 项目地址: https://pypi.org/project/kuavo-humanoid-sdk/
|
|
9
|
+
|
|
10
|
+
## 安装
|
|
11
|
+
**提示:对于本 SDK 目前存在两个版本,正式发布版与beta内测版, 他们的区别是:**
|
|
12
|
+
- 正式发布版:稳定版,对应[kuavo-ros-opensource](https://gitee.com/leju-robot/kuavo-ros-opensource/)的`master` 分支提供的功能,
|
|
13
|
+
- beta内测版:该版本较正式版会激进一些,同时也会提供更丰富的功能,对应[kuavo-ros-opensource](https://gitee.com/leju-robot/kuavo-ros-opensource/)的`beta` 分支提供的功能。
|
|
14
|
+
|
|
15
|
+
**温馨提示:请务必明确您需要安装的版本,如果您的SDK版本与`kuavo-ros-opensource`未匹配,可能会出现某些功能不可用的错误。**
|
|
16
|
+
|
|
17
|
+
安装最新的**正式版** Kuavo Humanoid SDK,可以使用 pip:
|
|
18
|
+
```bash
|
|
19
|
+
pip install kuavo-humanoid-sdk
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
安装最新的**beta版** Kuavo Humanoid SDK,可以使用 pip:
|
|
23
|
+
```bash
|
|
24
|
+
pip install --pre kuavo-humanoid-sdk
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
对于本地开发安装(可编辑模式),请使用:
|
|
28
|
+
```bash
|
|
29
|
+
cd src/kuavo_humanoid_sdk
|
|
30
|
+
chmod +x install.sh
|
|
31
|
+
./install.sh
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 升级更新
|
|
35
|
+
|
|
36
|
+
在升级更新之前,您可以先执行以下命令来查看当前安装的版本:
|
|
37
|
+
```bash
|
|
38
|
+
pip show kuavo-humanoid-sdk
|
|
39
|
+
# Output:
|
|
40
|
+
Name: kuavo-humanoid-sdk
|
|
41
|
+
Version: 0.1.2
|
|
42
|
+
...
|
|
43
|
+
```
|
|
44
|
+
**提示:如果您的版本号中包含字母`b`,则表示该版本为测试版, 比如`Version: 0.1.2b113`**
|
|
45
|
+
|
|
46
|
+
**当前为正式版**,升级到最新正式版:
|
|
47
|
+
```bash
|
|
48
|
+
pip install --upgrade kuavo_humanoid_sdk
|
|
49
|
+
```
|
|
50
|
+
**当前为beta版**,升级到最新正式版:
|
|
51
|
+
```bash
|
|
52
|
+
pip install --upgrade --force-reinstall kuavo_humanoid_sdk
|
|
53
|
+
# 或者
|
|
54
|
+
pip uninstall kuavo_humanoid_sdk && pip install kuavo_humanoid_sdk
|
|
55
|
+
```
|
|
56
|
+
**当前为正式版/beta版**,升级到最新beta版:
|
|
57
|
+
```bash
|
|
58
|
+
pip install --upgrade --pre kuavo_humanoid_sdk
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 描述
|
|
62
|
+
|
|
63
|
+
有关详细的 SDK 文档和使用示例,请参阅 [sdk_description.md](sdk_description.md)。
|
|
64
|
+
|
|
65
|
+
## 文档
|
|
66
|
+
文档提供两种格式:
|
|
67
|
+
- HTML 格式:[docs/html](docs/html), **需要自己执行脚本生成**
|
|
68
|
+
- Markdown 格式:[docs/markdown](docs/markdown)
|
|
69
|
+
|
|
70
|
+
我们推荐您自己执行文档脚本生成文档到本地, 文档会输出到`docs/html`和`docs/markdown`文件夹:
|
|
71
|
+
```bash
|
|
72
|
+
chmod +x ./gen_docs.sh
|
|
73
|
+
./gen_docs.sh
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
我们推荐您使用`html`查看文档更加方便,比如:
|
|
77
|
+

|
|
78
|
+
|
|
@@ -65,13 +65,13 @@ class EndEffectorState:
|
|
|
65
65
|
"""Data class representing the state of the end effector.
|
|
66
66
|
|
|
67
67
|
Args:
|
|
68
|
-
position (
|
|
69
|
-
velocity (
|
|
70
|
-
effort (
|
|
68
|
+
position (list): float, Position of the end effector, range: [0, 100]
|
|
69
|
+
velocity (list): float, ...
|
|
70
|
+
effort (list): float, ...
|
|
71
71
|
"""
|
|
72
|
-
position:
|
|
73
|
-
velocity:
|
|
74
|
-
effort:
|
|
72
|
+
position: list
|
|
73
|
+
velocity: list
|
|
74
|
+
effort: list
|
|
75
75
|
class GraspingState(Enum):
|
|
76
76
|
"""Enum class representing the grasping states of the end effector.
|
|
77
77
|
|
|
@@ -119,4 +119,27 @@ class KuavoIKParams:
|
|
|
119
119
|
# constraint and cost params
|
|
120
120
|
oritation_constraint_tol: float = 1e-3
|
|
121
121
|
pos_constraint_tol: float = 1e-3 # 0.001m, work when pos_cost_weight==0.0
|
|
122
|
-
pos_cost_weight: float = 0.0 # If U need high accuracy, set this to 0.0 !!!
|
|
122
|
+
pos_cost_weight: float = 0.0 # If U need high accuracy, set this to 0.0 !!!
|
|
123
|
+
|
|
124
|
+
@dataclass
|
|
125
|
+
class KuavoDexHandTouchState:
|
|
126
|
+
"""Data class representing the touch state of the dexterous hand."""
|
|
127
|
+
|
|
128
|
+
@dataclass
|
|
129
|
+
class KuavoTouchState:
|
|
130
|
+
"""Data class representing the touch state of the dexterous hand."""
|
|
131
|
+
normal_force1: int # 法向力1
|
|
132
|
+
normal_force2: int # 法向力2
|
|
133
|
+
normal_force3: int # 法向力3
|
|
134
|
+
tangential_force1: int # 切向力1
|
|
135
|
+
tangential_force2: int # 切向力2
|
|
136
|
+
tangential_force3: int # 切向力3
|
|
137
|
+
tangential_direction1: int # 切向力方向1
|
|
138
|
+
tangential_direction2: int # 切向力方向2
|
|
139
|
+
tangential_direction3: int # 切向力方向3
|
|
140
|
+
self_proximity1: int # 自电容接近传感器1
|
|
141
|
+
self_proximity2: int # 自电容接近传感器2
|
|
142
|
+
mutual_proximity: int # 互电容接近传感器
|
|
143
|
+
status: int # 传感器状态
|
|
144
|
+
# 5 fingers
|
|
145
|
+
data: Tuple[KuavoTouchState, KuavoTouchState, KuavoTouchState, KuavoTouchState, KuavoTouchState]
|
|
@@ -4,8 +4,27 @@ from kuavo_humanoid_sdk.interfaces.data_types import EndEffectorSide, EndEffecto
|
|
|
4
4
|
|
|
5
5
|
class EndEffector(ABC):
|
|
6
6
|
def __init__(self, joint_names: list):
|
|
7
|
-
self.
|
|
7
|
+
self._joint_names = joint_names
|
|
8
|
+
|
|
9
|
+
def joint_names(self)->list:
|
|
10
|
+
"""Returns the joint names of the end effector.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
list: The joint names of the end effector.
|
|
14
|
+
"""
|
|
15
|
+
return self._joint_names
|
|
16
|
+
|
|
17
|
+
def joint_count(self) -> int:
|
|
18
|
+
"""Returns the total number of joints in the end effector.
|
|
8
19
|
|
|
20
|
+
The joint_names list contains joints for both left and right end effectors.
|
|
21
|
+
For a single end effector, the number of joints would be joint_names.size/2.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
int: The total number of joints in the end effector.
|
|
25
|
+
"""
|
|
26
|
+
return len(self._joint_names)
|
|
27
|
+
|
|
9
28
|
@abstractmethod
|
|
10
29
|
def control(self, target_positions:list, target_velocities:list, target_torques:list)->bool:
|
|
11
30
|
pass
|
|
@@ -27,15 +46,15 @@ class EndEffector(ABC):
|
|
|
27
46
|
pass
|
|
28
47
|
|
|
29
48
|
@abstractmethod
|
|
30
|
-
def get_position(self)->Tuple[
|
|
49
|
+
def get_position(self)->Tuple[list, list]:
|
|
31
50
|
pass
|
|
32
51
|
|
|
33
52
|
@abstractmethod
|
|
34
|
-
def get_velocity(self)->Tuple[
|
|
53
|
+
def get_velocity(self)->Tuple[list, list]:
|
|
35
54
|
pass
|
|
36
55
|
|
|
37
56
|
@abstractmethod
|
|
38
|
-
def get_effort(self)->Tuple[
|
|
57
|
+
def get_effort(self)->Tuple[list, list]:
|
|
39
58
|
pass
|
|
40
59
|
|
|
41
60
|
@abstractmethod
|
{kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/__init__.py
RENAMED
|
@@ -3,5 +3,5 @@ from .robot_info import KuavoRobotInfo
|
|
|
3
3
|
from .robot_state import KuavoRobotState
|
|
4
4
|
from .robot_arm import KuavoRobotArm
|
|
5
5
|
from .robot_head import KuavoRobotHead
|
|
6
|
-
from .dexterous_hand import DexterousHand
|
|
6
|
+
from .dexterous_hand import DexterousHand, TouchDexterousHand
|
|
7
7
|
from .leju_claw import LejuClaw
|
{kuavo_humanoid_sdk-0.1.1 → kuavo_humanoid_sdk-1.1.2a692}/kuavo_humanoid_sdk/kuavo/core/core.py
RENAMED
|
@@ -28,7 +28,7 @@ from transitions import Machine, State
|
|
|
28
28
|
from kuavo_humanoid_sdk.interfaces.data_types import KuavoArmCtrlMode, KuavoIKParams, KuavoPose
|
|
29
29
|
from kuavo_humanoid_sdk.kuavo.core.ros.control import KuavoRobotControl
|
|
30
30
|
from kuavo_humanoid_sdk.kuavo.core.ros.state import KuavoRobotStateCore
|
|
31
|
-
from kuavo_humanoid_sdk.kuavo.core.ros.param import make_robot_param
|
|
31
|
+
from kuavo_humanoid_sdk.kuavo.core.ros.param import make_robot_param
|
|
32
32
|
from kuavo_humanoid_sdk.common.logger import SDKLogger
|
|
33
33
|
|
|
34
34
|
# Define robot states
|
|
@@ -78,7 +78,6 @@ class KuavoRobotCore:
|
|
|
78
78
|
raise RuntimeError if initialize failed.
|
|
79
79
|
"""
|
|
80
80
|
try:
|
|
81
|
-
info = make_robot_param()
|
|
82
81
|
# init state by gait_name
|
|
83
82
|
gait_name = self._rb_state.gait_name()
|
|
84
83
|
if gait_name is not None:
|
|
@@ -173,15 +172,20 @@ class KuavoRobotCore:
|
|
|
173
172
|
SDKLogger.warn(f"[Core] control torso height failed, robot is not in stance state({self.state})!")
|
|
174
173
|
return False
|
|
175
174
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
MIN_HEIGHT = -0.35
|
|
176
|
+
MAX_HEIGHT = 0.0
|
|
177
|
+
MIN_PITCH = -0.4
|
|
178
|
+
MAX_PITCH = 0.4
|
|
180
179
|
|
|
181
|
-
# Limit
|
|
182
|
-
|
|
183
|
-
if
|
|
184
|
-
SDKLogger.warn(f"[Core]
|
|
180
|
+
# Limit height range
|
|
181
|
+
limited_height = min(MAX_HEIGHT, max(MIN_HEIGHT, height))
|
|
182
|
+
if height > MAX_HEIGHT or height < MIN_HEIGHT:
|
|
183
|
+
SDKLogger.warn(f"[Core] height {height} exceeds limit [{MIN_HEIGHT}, {MAX_HEIGHT}], will be limited")
|
|
184
|
+
|
|
185
|
+
# Limit pitch range
|
|
186
|
+
limited_pitch = min(MAX_PITCH, max(MIN_PITCH, pitch))
|
|
187
|
+
if abs(pitch) > MAX_PITCH:
|
|
188
|
+
SDKLogger.warn(f"[Core] pitch {pitch} exceeds limit [{MIN_PITCH}, {MAX_PITCH}], will be limited")
|
|
185
189
|
|
|
186
190
|
return self._control.control_torso_height(limited_height, limited_pitch)
|
|
187
191
|
|
|
@@ -238,9 +242,9 @@ class KuavoRobotCore:
|
|
|
238
242
|
max_y_step = 0.20
|
|
239
243
|
max_yaw_step = 90
|
|
240
244
|
else:
|
|
241
|
-
max_x_step = 0.
|
|
242
|
-
max_y_step = 0.
|
|
243
|
-
max_yaw_step =
|
|
245
|
+
max_x_step = 0.15
|
|
246
|
+
max_y_step = 0.15
|
|
247
|
+
max_yaw_step = 45
|
|
244
248
|
|
|
245
249
|
body_poses = []
|
|
246
250
|
|
|
@@ -294,6 +298,10 @@ class KuavoRobotCore:
|
|
|
294
298
|
def control_robot_dexhand(self, left_position:list, right_position:list)->bool:
|
|
295
299
|
return self._control.control_robot_dexhand(left_position, right_position)
|
|
296
300
|
|
|
301
|
+
def robot_dexhand_command(self, data, ctrl_mode, hand_side):
|
|
302
|
+
return self._control.robot_dexhand_command(data, ctrl_mode, hand_side)
|
|
303
|
+
|
|
304
|
+
|
|
297
305
|
def control_leju_claw(self, postions:list, velocities:list=[90, 90], torques:list=[1.0, 1.0]) ->bool:
|
|
298
306
|
return self._control.control_leju_claw(postions, velocities, torques)
|
|
299
307
|
|
|
@@ -4,6 +4,7 @@ from queue import Queue
|
|
|
4
4
|
from kuavo_humanoid_sdk.interfaces.data_types import EndEffectorSide
|
|
5
5
|
from kuavo_humanoid_sdk.kuavo.core.core import KuavoRobotCore
|
|
6
6
|
from kuavo_humanoid_sdk.common.logger import SDKLogger
|
|
7
|
+
from kuavo_humanoid_sdk.kuavo.core.ros.param import make_robot_param, EndEffectorType
|
|
7
8
|
class DexHandControl:
|
|
8
9
|
_instance = None
|
|
9
10
|
|
|
@@ -19,6 +20,8 @@ class DexHandControl:
|
|
|
19
20
|
self.thread = threading.Thread(target=self._process_queue) # Create a thread to process the queue
|
|
20
21
|
self.thread.daemon = True # Set the thread as a daemon so it will exit when the main program exits
|
|
21
22
|
self.thread.start() # Start the thread
|
|
23
|
+
kuavo_info = make_robot_param()
|
|
24
|
+
self._ee_type = kuavo_info['end_effector_type']
|
|
22
25
|
# Initialize last command position, torque, and velocity
|
|
23
26
|
self.last_cmd_position = {EndEffectorSide.LEFT: [0] * 6, EndEffectorSide.RIGHT: [0] * 6}
|
|
24
27
|
self._initialized = True
|
|
@@ -26,6 +29,9 @@ class DexHandControl:
|
|
|
26
29
|
def control(self, target_positions: list, side: EndEffectorSide):
|
|
27
30
|
self.queue.put(('position', EndEffectorSide(side.value), target_positions))
|
|
28
31
|
|
|
32
|
+
def control_velocity(self, target_velocities: list, side: EndEffectorSide):
|
|
33
|
+
self.queue.put(('velocity', EndEffectorSide(side.value), target_velocities))
|
|
34
|
+
|
|
29
35
|
def make_gestures(self, gestures:list)->bool:
|
|
30
36
|
"""
|
|
31
37
|
Make a gesture for the dexhand.
|
|
@@ -60,26 +66,49 @@ class DexHandControl:
|
|
|
60
66
|
return None
|
|
61
67
|
return gs
|
|
62
68
|
|
|
69
|
+
|
|
70
|
+
def _process_dexhand_command(self, command, side, data):
|
|
71
|
+
if command == 'position':
|
|
72
|
+
pos = self.last_cmd_position[EndEffectorSide.LEFT] + self.last_cmd_position[EndEffectorSide.RIGHT]
|
|
73
|
+
if side == EndEffectorSide.BOTH:
|
|
74
|
+
pos = copy.deepcopy(data)
|
|
75
|
+
elif side == EndEffectorSide.LEFT:
|
|
76
|
+
pos[:6] = data
|
|
77
|
+
elif side == EndEffectorSide.RIGHT:
|
|
78
|
+
pos[6:] = data
|
|
79
|
+
else:
|
|
80
|
+
return
|
|
81
|
+
self._kuavo_core.control_robot_dexhand(left_position=pos[:6], right_position=pos[6:])
|
|
82
|
+
self.last_cmd_position[EndEffectorSide.LEFT] = pos[:6]
|
|
83
|
+
self.last_cmd_position[EndEffectorSide.RIGHT] = pos[6:]
|
|
84
|
+
|
|
85
|
+
def _process_touch_dexhand_command(self, command, side, data):
|
|
86
|
+
if command == 'position':
|
|
87
|
+
ctrl_mode = 0
|
|
88
|
+
if side == EndEffectorSide.BOTH:
|
|
89
|
+
self._kuavo_core.robot_dexhand_command(data, ctrl_mode, 2)
|
|
90
|
+
elif side == EndEffectorSide.LEFT:
|
|
91
|
+
self._kuavo_core.robot_dexhand_command(data, ctrl_mode, 0)
|
|
92
|
+
elif side == EndEffectorSide.RIGHT:
|
|
93
|
+
self._kuavo_core.robot_dexhand_command(data, ctrl_mode, 1)
|
|
94
|
+
elif command == 'velocity':
|
|
95
|
+
ctrl_mode = 0
|
|
96
|
+
if side == EndEffectorSide.BOTH:
|
|
97
|
+
self._kuavo_core.robot_dexhand_command(data, ctrl_mode, 2)
|
|
98
|
+
elif side == EndEffectorSide.LEFT:
|
|
99
|
+
self._kuavo_core.robot_dexhand_command(data, ctrl_mode, 0)
|
|
100
|
+
elif side == EndEffectorSide.RIGHT:
|
|
101
|
+
self._kuavo_core.robot_dexhand_command(data, ctrl_mode, 1)
|
|
102
|
+
|
|
63
103
|
def _process_queue(self):
|
|
64
104
|
while True:
|
|
65
105
|
try:
|
|
66
106
|
command, side, data = self.queue.get() # This will block until an item is available in the queue
|
|
67
107
|
SDKLogger.debug(f'[DexHandControl] Received command: {command}, for side: {side}, with data: {data}')
|
|
68
|
-
if
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
elif side == EndEffectorSide.LEFT:
|
|
73
|
-
pos[:6] = data
|
|
74
|
-
elif side == EndEffectorSide.RIGHT:
|
|
75
|
-
pos[6:] = data
|
|
76
|
-
else:
|
|
77
|
-
return
|
|
78
|
-
self._kuavo_core.control_robot_dexhand(left_position=pos[:6], right_position=pos[6:])
|
|
79
|
-
self.last_cmd_position[EndEffectorSide.LEFT] = pos[:6]
|
|
80
|
-
self.last_cmd_position[EndEffectorSide.RIGHT] = pos[6:]
|
|
81
|
-
|
|
82
|
-
# task done.
|
|
108
|
+
if self._ee_type == EndEffectorType.QIANGNAO:
|
|
109
|
+
self._process_dexhand_command(command, side, data)
|
|
110
|
+
elif self._ee_type == EndEffectorType.QIANGNAO_TOUCH:
|
|
111
|
+
self._process_touch_dexhand_command(command, side, data)
|
|
83
112
|
self.queue.task_done()
|
|
84
113
|
except KeyboardInterrupt:
|
|
85
114
|
break
|