骨骼与震动数据
数据模型
当前版本 · 2.0.0
HandJointCommand
HandJointCommand 表示一组关节角输出,包含 target、关节名到角度的映射、输出时间、可选 source 和 metadata。device.output() 与 skeleton().joint_angles() 都提供这类数据的读取;每次读取获得 Sample[HandJointCommand],其中 sample.value 才是 HandJointCommand。该类型本身不规定固定的关节名称和数量。
字段
| 字段 | 类型 | 可为空 | 说明 |
|---|---|---|---|
target | str | 否 | 目标标识 |
joints | dict[str, float] | 否 | 关节名称到目标位置的映射 |
timestamp | float | 否 | 输出时间戳,单位毫秒 |
source | str | None | 是 | 产生该输出的 source ID |
metadata | dict[str, object] | 否 | 算法附加信息,可为空映射 |
Skeleton 固定关节
当数据来自 skeleton().joint_angles() 时,HandJointCommand.joints 固定包含以下 25 个 active joints。名称中的 <side> 替换为 left 或 right;你的代码应按关节名读取,不能依赖 JSON/字典的键遍历顺序。
| 索引 | 关节名 |
|---|---|
| 0 | <side>_thumb_cmc_abduction |
| 1 | <side>_thumb_cmc_flexion |
| 2 | <side>_thumb_cmc_opposition |
| 3 | <side>_thumb_mcp_abduction |
| 4 | <side>_thumb_mcp_flexion |
| 5 | <side>_thumb_ip_flexion |
| 6 | <side>_index_mcp_abduction |
| 7 | <side>_index_mcp_flexion |
| 8 | <side>_index_pip_flexion |
| 9 | <side>_index_dip_flexion |
| 10 | <side>_middle_mcp_abduction |
| 11 | <side>_middle_mcp_flexion |
| 12 | <side>_middle_pip_flexion |
| 13 | <side>_middle_dip_flexion |
| 14 | <side>_ring_cmc_cup |
| 15 | <side>_ring_mcp_abduction |
| 16 | <side>_ring_mcp_flexion |
| 17 | <side>_ring_pip_flexion |
| 18 | <side>_ring_dip_flexion |
| 19 | <side>_little_cmc_opposition |
| 20 | <side>_little_cmc_cup |
| 21 | <side>_little_mcp_abduction |
| 22 | <side>_little_mcp_flexion |
| 23 | <side>_little_pip_flexion |
| 24 | <side>_little_dip_flexion |
device.output() 提供的灵巧手输出仍使用 HandJointCommand,但关节名称和数量由对应灵巧手算法包定义,不使用上述 Skeleton 固定列表。
HandSkeletonPose
HandSkeletonPose 是 skeleton().pose() 发布的 OpenXR 骨骼节点姿态,用于按相同索引读取 25 个节点的名称、位置和旋转。
字段
| 字段 | 类型 | 可为空 | 说明 |
|---|---|---|---|
timestamp_ms | float | 否 | 骨骼输出时间,单位为毫秒 |
hand_side | Side | 否 | 左右手 |
coordinate_frame | str | 否 | 当前为 wrist_local |
names | tuple[str, ...] | 否 | 25 个骨骼节点名称,顺序与位置和旋转数组一致 |
positions_local | tuple[tuple[float, float, float], ...] | 否 | 25 个 wrist-local 节点位置 |
orientations_local_xyzw | tuple[tuple[float, float, float, float], ...] | 否 | 25 个 wrist-local 节点 XYZW 四元数 |
Haptics
GloveHaptics 的兼容别名为 Haptics。
Haptics 同时用于 set() 的输入,以及 latest() 和 subscribe() 取得的震动输出状态。device.haptics() 返回指尖震动控制和读取入口,不直接返回 Haptics。
字段
| 字段 | 类型 | 可为空 | 说明 |
|---|---|---|---|
strengths | dict[GloveFinger, int] | 否 | 手指到 0..127 整数震动强度的映射;可为空映射,未列出的手指不包含在当前震动设置中 |