> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wuji.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# IMU

A single 6-axis IMU (3-axis gyroscope plus 3-axis accelerometer, no magnetometer) sits inside the back-of-hand module, with two subscription APIs:

| API | Data | `orientation` |
| - | - | - |
| `glove.imu_palm()` | Raw data: angular velocity + linear acceleration | Unavailable (`orientation_covariance[0]` = -1, see REP-145) |
| `glove.imu_data_palm()` | Fused data: raw data + complementary-filter orientation | Available |

```python theme={null}
# Fused data: with orientation
sub = glove.imu_data_palm().subscribe()
imu = await sub.recv_async()
print(f"Orientation: {imu.orientation}")        # quaternion (x, y, z, w)
print(f"Angular velocity: {imu.angular_velocity}")    # rad/s
print(f"Linear acceleration: {imu.linear_acceleration}") # m/s²

# Raw data: angular velocity and linear acceleration only
sub = glove.imu_palm().subscribe()
raw = await sub.recv_async()
print(f"Angular velocity: {raw.angular_velocity}, linear acceleration: {raw.linear_acceleration}")
```

<Info>
  The fused orientation comes from an SDK complementary filter that starts when the **first subscriber** opens the stream. Roll and pitch initialize from the first accelerometer frame against gravity and stay stable long term, while yaw has no absolute reference — it zeroes at stream start and drifts slowly over time. Yaw resets only after every subscriber, including indirect ones such as `tf`, has unsubscribed and the stream restarts.
</Info>

<Info>
  IMU data is compatible with ROS `sensor_msgs/Imu` and can be plugged directly into a ROS integration. Both streams can be recorded to MCAP files with TopicRecorder. See the SDK [Data Recording](/en/docs/wuji-sdk/data-recording) page.
</Info>

## ImuData

IMU sensor data, compatible with ROS `sensor_msgs/Imu`.

| Field | Type | Description |
| - | - | - |
| `header` | [FrameHeader](/en/docs/wuji-sdk/data-reference#frameheader) | Frame header |
| `orientation` | [Quaternion](/en/docs/wuji-sdk/data-reference#quaternion) | Orientation quaternion. Fused value on `imu_data_palm()` only (`orientation_covariance[0]` = 0) — on `imu_palm()` it is the identity quaternion with `orientation_covariance[0]` = -1 marking it unavailable (REP-145) |
| `orientation_covariance` | `List[float]` | Orientation covariance matrix (3×3, row-major) |
| `angular_velocity` | [Vector3F64](/en/docs/wuji-sdk/data-reference/#vector3-/-vector3f64) | Angular velocity (rad/s) |
| `angular_velocity_covariance` | `List[float]` | Angular velocity covariance matrix |
| `linear_acceleration` | [Vector3F64](/en/docs/wuji-sdk/data-reference/#vector3-/-vector3f64) | Linear acceleration (m/s²) |
| `linear_acceleration_covariance` | `List[float]` | Linear acceleration covariance matrix |

Sample raw frame from `imu_palm()`:

```json theme={null}
{
  "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]
}
```

<Tabs>
  <Tab title="Python">
    Python: See the Python API examples earlier on this page.
  </Tab>

  <Tab title="C">
    The C SDK provides typed subscriptions for palm raw IMU and fused IMU data.

    ```c theme={null}
    wuji_glove_subscribe_imu_palm(dev, on_imu, user_data, &imu_sub);
    wuji_glove_subscribe_imu_data_palm(dev, on_imu_data, user_data, &imu_data_sub);
    ```

    Frame pointers are valid only during the callback. Call `wuji_sub_close` when the subscriptions are no longer needed.
  </Tab>
</Tabs>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.