# C202 第 1 课：IMU 测量什么，又会怎样出错

> C202 IMU 课程的第一课：采集设备的陀螺仪和加速度计测量什么，头戴采集设备为什么需要它们，标定能消除的系统误差和只能测量的随机误差，一个 IMU 需要的三种标定，以及硬件必须先做对的事情。

Page: https://egocam.ai/zh-cn/university/c202/lesson-1-what-the-imu-measures/

IMU 是一颗小芯片，很容易被当成附带的东西。在头戴采集设备上，正是它让跟踪在快速转头时不丢失，并让素材有了上、下和真实世界尺度的概念。本课讲 IMU 测量什么，它内部会出什么问题，以及哪些标定能把它纠正过来。完整的讲解见[采集设备的 IMU 标定](https://egocam.ai/zh-cn/calibration/imu-calibration/)和[可穿戴采集设备上的 IMU](https://egocam.ai/zh-cn/hardware/imu-sensors/)。

## 本课用到的术语

这些术语也都收在[术语表的硬件](https://egocam.ai/zh-cn/reference/glossary/)和[标定](https://egocam.ai/zh-cn/reference/glossary/)两节中。

| 术语 | 含义 |
|---|---|
| IMU | 惯性测量单元（inertial measurement unit）：三轴陀螺仪和三轴加速度计封装在一个器件里（6 轴器件）；9 轴器件再加一个磁力计 |
| 陀螺仪 | 测量绕每个轴的角速度（旋转速率） |
| 比力（specific force） | 加速度计测量的量：加速度减去重力，所以静止时它的读数约为 1 g，方向朝上 |
| 输出数据率（output data rate，ODR） | IMU 每秒给出多少个采样，单位为 Hz |
| 满量程范围（full-scale range） | 传感器在输出被截顶之前能报告的最大旋转速率或加速度 |
| 零偏（bias） | 没有运动时传感器给出的读数；它随温度和时间变化 |
| 比例因子（scale factor） | 传感器在其量程内读数偏高或偏低的程度 |
| 轴失准（axis misalignment） | 三个轴彼此之间以及与外壳之间偏离垂直的程度 |
| 噪声密度（noise density） | 传感器白噪声的强度，以每根号赫兹计 |
| 零偏随机游走（bias random walk） | 零偏游走得有多快，按随机游走建模 |

## IMU 给相机增加了什么

把陀螺仪在两帧之间的输出积分，就得到这段间隔内的旋转。静止的加速度计能显示哪个方向是下。而且 IMU 在相邻两帧相机图像之间会报告很多次（[采集设备的 IMU 标定](https://egocam.ai/zh-cn/calibration/imu-calibration/)）。

> **Diagram:** Camera frames are tens of milliseconds apart. The IMU reports many times in between, so it carries the motion across each gap, and through blur.

这给了相机三样它自己没有的东西：

- **帧间运动**。在快速转头、运动模糊以及相机只看到一面空白墙的时刻，只有 IMU 知道头部是怎么动的。
- **重力**。[TUM VI benchmark](https://arxiv.org/abs/1804.06120) 论文是这样说的："Adding an inertial measurement unit (IMU) helps dealing with untextured environments and rapid motions and makes roll and pitch directly observable."（意为：加入惯性测量单元（IMU）有助于应对无纹理环境和快速运动，并使横滚和俯仰可以直接观测。）
- **尺度**。单台相机分不清近处的小物体和远处的大物体。[VINS-Mono](https://arxiv.org/abs/1708.03852) 的作者把一台相机加一个低成本 IMU 称为 "the minimum sensor suite for metric six degrees-of-freedom (DOF) state estimation"（意为：做带真实尺度的六自由度（DOF）状态估计所需的最小传感器组合）。

当前的采集设备反映了这一点。实用指南中 2025–2026 年已发表采集设备的表格显示，相机头部装有一个或两个 6 轴 MEMS IMU，采样率为 200 到 800 Hz，由触发相机的同一个控制器读取（[可穿戴采集设备上的 IMU](https://egocam.ai/zh-cn/hardware/imu-sensors/)）。

## IMU 内部会出什么问题

低成本 MEMS IMU，也就是采集设备上用的那种，有两类误差（[采集设备的 IMU 标定](https://egocam.ai/zh-cn/calibration/imu-calibration/)）。

**系统误差**会重复出现，所以标定可以测出并消除它们：零偏、比例因子和轴失准。

> **Diagram:** The systematic errors calibration removes: a bias that reads something at rest, a scale factor that reads too high or low, and axes that are not quite square.

**随机误差**无法消除，只能测量，好让估计器知道每个采样该信多少。Kalibr 的 [IMU 噪声模型](https://github.com/ethz-asl/kalibr/wiki/IMU-Noise-Model)对每个传感器用两个数：白噪声，即 "an additive noise term that fluctuates very rapidly"（意为：一个波动非常快的加性噪声项），以及会游走的零偏，即 "a slowly varying sensor bias"（意为：一个缓慢变化的传感器零偏）。第 2 课讲如何测量它们。

在这两类误差之上，零偏还随温度变化。Kalibr 的模型描述的是 "at constant temperature"（意为：处于恒定温度下）的传感器，而 BMI160 的规格书给出的温度漂移是 0.05 °/s/K，所以升温 10 K 会让该器件的陀螺仪零偏移动 0.5 °/s（[可穿戴采集设备上的 IMU](https://egocam.ai/zh-cn/hardware/imu-sensors/)）。在人头上逐渐升温的采集设备，它的零偏已经不是在工作台上时的那个零偏。

## 三种标定，而不是一种

相机采集设备上的 IMU 需要测量三样东西（[采集设备的 IMU 标定](https://egocam.ai/zh-cn/calibration/imu-calibration/)）：

| 标定 | 求出什么 | 怎么做 | 在本课程中 |
|---|---|---|---|
| IMU 自身 | 零偏、比例和失准；噪声值 | 在若干静止姿态下以重力为参考；对一段长时间静止日志求 Allan 偏差 | 第 2 课，实验 A 部分 |
| 空间，相机到 IMU | IMU 与每台相机之间的旋转和平移 | Kalibr，采集设备在固定的标定板前移动 | 第 3 课，实验 B 部分 |
| 时间，相机到 IMU | 相机时间戳和 IMU 时间戳之间的时间偏移 | 在同一次 Kalibr 运行中估计，也由跟踪器在线估计 | 第 4 课，实验 B 部分 |

对系统误差来说，重力是一个不花钱的参考。以任意姿态保持静止时，加速度计的读数应当是一个 g。Tedaldi、Pretto 和 Menegatti 的方法 "only requires the sensor to be moved by hand and placed in a set of different, static positions"（意为：只需要用手移动传感器，并把它摆放在一组不同的静止位置上）（[Tedaldi et al., 2014](https://doi.org/10.1109/ICRA.2014.6907297)）。

> **Diagram:** Gravity is a free, perfectly known reference. Held still in many attitudes, the accelerometer must read one g every time; the rotations between poses check the gyroscope.

Kalibr 也可以在相机–IMU 标定过程中估计比例和失准。它的相机–IMU 指南说，IMU 的内参 "need to be calibrated beforehand and its correction applied to the raw measurements. If not, one should use an IMU model which calibrates these values"（意为：需要事先标定，并把修正应用到原始测量值上。否则，应当使用一种会标定这些值的 IMU 模型）（[camera–IMU calibration](https://github.com/ethz-asl/kalibr/wiki/camera-imu-calibration)）。第 3 课讲这些模型。

之所以有时间标定，用 Qin 和 Shen 的话说，是因为 "timestamps of each sensor typically suffer from triggering and transmission delays, leading to temporal misalignment (time offsets) among different sensors"（意为：每个传感器的时间戳通常都受触发延迟和传输延迟的影响，导致不同传感器之间在时间上不对齐（时间偏移））（[Qin and Shen, 2018](https://arxiv.org/abs/1808.00692)）。

## 硬件必须先做对什么

让 IMU 容易标定的因素，大部分在采集设备设计时就定下来了（[采集设备的 IMU 标定](https://egocam.ai/zh-cn/calibration/imu-calibration/)、[可穿戴采集设备上的 IMU](https://egocam.ai/zh-cn/hardware/imu-sensors/)）：

- **刚性安装在相机旁边**。标定求出的是一个固定的变换；如果 IMU 和相机之间的部件会弯曲，这个变换就会变。
- **一个时钟**。IMU 和相机在硬件中打时间戳，来自同一个时钟，速率稳定。Kalibr 的指南要求你 "ensure low jitter timestamps in same clock"（意为：确保时间戳抖动小，并且在同一个时钟上）。标定估计的是一个恒定的时间偏移；抖动是一个常数无法吸收的噪声，而两个彼此漂移的时钟会让偏移在录制过程中变化（[偏移在一次录制中发生变化时](https://egocam.ai/zh-cn/calibration/camera-imu-time-offset/)）。
- **不会截顶的量程**。头转得很快：[Miller et al. (2020)](https://doi.org/10.1007/s10237-019-01267-6) 发现日常活动中头部旋转速度的峰值接近 12.8 rad/s，约 730 °/s。被陀螺仪截顶的旋转事后无法恢复。
- **远高于帧率的采样率**。在每秒 30 帧时，200 Hz 的 IMU 在每个帧间隔内给出约 6.7 个采样，800 Hz 的给出约 26.7 个。

不在头部转动轴线上的 IMU 还会感受到向心加速度。那是真实的运动，标定会对它建模，但加速度计的量程必须覆盖它。

> **Diagram:** An IMU offset from the axis a head turns about feels centripetal acceleration a = ω²r (plus ω̇ × r while the turn speeds up or slows down). At an assumed 500°/s, 5 cm from the axis gives 3.8 m/s² (0.39 g) and 10 cm gives 7.6 m/s² (0.78 g). This is real motion that calibration models, but the accelerometer's range must cover it, and an error in the calibrated lever arm grows with r.

## 自测

1. 说出 IMU 给头戴相机的、相机自己得不到的三样东西。
2. IMU 的哪些误差可以由标定消除，哪些只能测量？
3. 你的 IMU 的比例和失准从未修正过。Kalibr 的相机–IMU 指南说该怎么做？
4. 如果噪声值是在工作台上仔细测出来的，温度变化为什么还有影响？
5. 一位同事为了得到最好的分辨率，把陀螺仪设到了最小量程。在头戴采集设备上会出什么问题？

### 答案

1. 帧间运动（在快速转头和模糊期间）、重力方向，以及真实尺度。
2. 零偏、比例因子和轴失准是系统误差，可以消除。白噪声和零偏随机游走是随机误差，只能测量，好让估计器知道该信传感器多少。
3. 事先标定它们并修正原始测量值，或者在 Kalibr 中使用一种会估计它们的 IMU 模型，例如 `scale-misalignment`。
4. 零偏随温度变化，而 Kalibr 的噪声模型假定温度恒定。在头上升温的采集设备，其零偏与在工作台上时不同。
5. 快速转头在日常活动中接近 730 °/s，可能超出量程而被截顶，丢失的旋转事后无法恢复。

## 参考来源

- 实用指南：[采集设备的 IMU 标定](https://egocam.ai/zh-cn/calibration/imu-calibration/)、[可穿戴采集设备上的 IMU](https://egocam.ai/zh-cn/hardware/imu-sensors/)、[术语表](https://egocam.ai/zh-cn/reference/glossary/)。
- Kalibr wiki，ETH Zurich ASL：[IMU noise model](https://github.com/ethz-asl/kalibr/wiki/IMU-Noise-Model) 和 [camera–IMU calibration](https://github.com/ethz-asl/kalibr/wiki/camera-imu-calibration)。
- Schubert, D. et al. (2018). [The TUM VI benchmark for evaluating visual-inertial odometry](https://arxiv.org/abs/1804.06120). *IEEE/RSJ IROS*.
- Qin, T., Li, P. and Shen, S. (2018). [VINS-Mono: A robust and versatile monocular visual-inertial state estimator](https://arxiv.org/abs/1708.03852). *IEEE Transactions on Robotics*.
- Qin, T. and Shen, S. (2018). [Online temporal calibration for monocular visual-inertial systems](https://arxiv.org/abs/1808.00692). *IEEE/RSJ IROS*.
- Miller, L. E. et al. (2020). [An envelope of linear and rotational head motion during everyday activities](https://doi.org/10.1007/s10237-019-01267-6). *Biomechanics and Modeling in Mechanobiology*.
- Tedaldi, D., Pretto, A. and Menegatti, E. (2014). [A robust and easy to implement method for IMU calibration without external equipments](https://doi.org/10.1109/ICRA.2014.6907297). *IEEE ICRA*.
