SDK 数据参考
IMU 数据
手背模组内搭载 1 个 6 轴 IMU(3 轴陀螺仪 + 3 轴加速度计,不含磁力计),提供两组订阅接口:
| API | 数据 | orientation |
|---|---|---|
glove.imu_palm() | 原始数据:角速度 + 线加速度 | 不可用(orientation_covariance[0] = -1,见 REP-145) |
glove.imu_data_palm() | 融合数据:原始数据 + 互补滤波解算的朝向 | 可用 |
# 融合数据:带朝向
sub = glove.imu_data_palm().subscribe()
imu = await sub.recv_async()
print(f"朝向: {imu.orientation}") # 四元数 (x, y, z, w)
print(f"角速度: {imu.angular_velocity}") # rad/s
print(f"线加速度: {imu.linear_acceleration}") # m/s²
# 原始数据:仅角速度与线加速度
sub = glove.imu_palm().subscribe()
raw = await sub.recv_async()
print(f"角速度: {raw.angular_velocity}, 线加速度: {raw.linear_acceleration}")融合朝向由 SDK 互补滤波给出,滤波在首个订阅者建立数据流时启动。roll / pitch 由首帧加速度按重力初始化并长期稳定,yaw 缺少绝对参考,以数据流启动时刻为零点,长期会缓慢漂移。所有订阅者(含 tf 这类间接依赖)都取消订阅后重新订阅,yaw 零点才会重置。
IMU 数据格式与 ROS sensor_msgs/Imu 兼容,可直接用于 ROS 生态系统集成。两组数据流均可用 TopicRecorder 录制为 MCAP 文件导出,见 SDK 数据录制。
ImuData
IMU 传感器数据,兼容 ROS sensor_msgs/Imu。
| 字段 | 类型 | 说明 |
|---|---|---|
header | FrameHeader | 帧头 |
orientation | Quaternion | 朝向四元数。仅 imu_data_palm() 提供融合值(orientation_covariance[0] = 0),imu_palm() 上为单位四元数且 orientation_covariance[0] = -1 表示不可用(REP-145) |
orientation_covariance | List[float] | 朝向协方差矩阵(3×3,行优先) |
angular_velocity | Vector3F64 | 角速度(rad/s) |
angular_velocity_covariance | List[float] | 角速度协方差矩阵 |
linear_acceleration | Vector3F64 | 线加速度(m/s²) |
linear_acceleration_covariance | List[float] | 线加速度协方差矩阵 |
imu_palm() 原始数据帧示例:
{
"header": {
"seq": 500,
"timestamp_us": 1709876543210,
"frame_id": ""
},
"orientation": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 1.0
},
"orientation_covariance": [-1, 0, 0, 0, 0, 0, 0, 0, 0],
"angular_velocity": {
"x": 0.01,
"y": -0.02,
"z": 0.005
},
"angular_velocity_covariance": [0, 0, 0, 0, 0, 0, 0, 0, 0],
"linear_acceleration": {
"x": 0.1,
"y": -0.05,
"z": 9.8
},
"linear_acceleration_covariance": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}