数据查询
get_base_data()
Python
get_base_data(key: str) -> list[float]
读取基体(躯干)的运动学数据,约 100 Hz 更新。
key 值 | 返回维度 | 说明 |
|---|---|---|
'quat_xyzw' | 4 | 姿态四元数(x, y, z, w),base → world |
'quat_wxyz' | 4 | 姿态四元数(w, x, y, z),base → world |
'rpy' | 3 | 横滚 / 俯仰 / 偏航角(rad) |
'omega_W' | 3 | 角速度,世界坐标系(rad/s) |
'omega_B' | 3 | 角速度,机体坐标系(rad/s) |
'acc_W' | 3 | 线加速度,世界坐标系(m/s²) |
'acc_B' | 3 | 线加速度,机体坐标系(m/s²) |
'vel_W' | 3 | 线速度,世界坐标系(m/s) |
'vel_B' | 3 | 线速度,机体坐标系(m/s) |
'pos_W' | 3 | 位置,世界坐标系(m) |
示例
Python
rpy = client.get_base_data("rpy")
print(f"roll={rpy[0]:.3f}, pitch={rpy[1]:.3f}, yaw={rpy[2]:.3f}")
get_true_data()
Python
get_true_data(key: str) -> list[float]
读取仿真或估计的真值数据。
key 值 | 说明 |
|---|---|
'vel_B' | 线速度,机体坐标系(m/s) |
'vel_W' | 线速度,世界坐标系(m/s) |
'pos_W' | 位置,世界坐标系(m) |
'contact_fz' | 各脚接触法向力(N) |
'contact_prob' | 各脚接触概率 [0, 1] |
get_contact_data()
Python
get_contact_data(key: str) -> list[float]
读取脚部接触传感器数据。
key 值 | 说明 |
|---|---|
'contact_force' | 各脚接触力(N) |
'contact_prob' | 各脚接触概率 [0, 1] |
示例
Python
force = client.get_contact_data("contact_force")
prob = client.get_contact_data("contact_prob")
print(f"contact force: {force}, prob: {prob}")
get_cartesian_state()
Python
get_cartesian_state(group_name: str, key: str = 'pose') -> list[float]
读取指定末端执行器的笛卡尔状态。
| 参数 | 类型 | 说明 |
|---|---|---|
group_name | str | 关节组名称(如 "left_manipulator") |
key | str | 状态类型,见下表 |
key 值 | 说明 |
|---|---|
'pose' | 末端位姿(位置 + 四元数),默认 |
'twist' | 末端速度(线速度 + 角速度) |
'wrench' | 末端力/力矩 |
示例
Python
pose = client.get_cartesian_state("left_manipulator", key="pose")
print(f"left end-effector pose: {pose}")