宇树机器人对接Python-手部动作

前言

SDK地址

https://support.unitree.com/home/zh/G1_developer/sdk_overview

上位机连接

https://support.unitree.com/home/zh/G1_developer/quick_development

高层运动

https://support.unitree.com/home/zh/G1_developer/sport_services_interface

工单

https://serviceconsole.unitree.com/#/new-work-order?progress=1

基本示例

1
2
3
4
5
6
from unitree_sdk2py.g1.arm.g1_arm_action_client import G1ArmActionClient
from unitree_sdk2py.g1.arm.g1_arm_action_client import action_map

armAction_client = G1ArmActionClient()
armAction_client.SetTimeout(10.0)
armAction_client.Init()

做动作

1
2
3
4
5
result = armAction_client.ExecuteAction(action_map.get("left kiss"))
print(result)
if result == 0:
time.sleep(2)
armAction_client.ExecuteAction(action_map.get("release arm"))

系列动作

1
2
3
4
5
6
7
action_name_arr = ["left kiss","right kiss","two-hand kiss"]
for action_name in action_name_arr:
result = armAction_client.ExecuteAction(action_map.get(action_name))
print(result)
if result ==0:
time.sleep(2)
armAction_client.ExecuteAction(action_map.get("release arm"))

支持的动作

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
action_map = {
"release arm": 99,
"two-hand kiss": 11,
"left kiss": 12,
"right kiss": 13,
"hands up": 15,
"clap": 17,
"high five": 18,
"hug": 19,
"heart": 20,
"right heart": 21,
"reject": 22,
"right hand up": 23,
"x-ray": 24,
"face wave": 25,
"high wave": 26,
"shake hand": 27,
}