An inertial measurement unit (IMU) is a tiny chip that feels motion. It usually holds an accelerometer and a gyro.
Key idea
At rest, the accelerometer feels only gravity, so its tilt is $\theta = \arctan(a_x / a_z)$. The gyro measures turn rate $\omega$; adding it up, $\theta \leftarrow \theta + \omega\,\Delta t$, gives angle, but small errors pile up, so the angle drifts.
Why it works
The accelerometer cannot tell gravity from speeding up, so it is fooled during motion. The gyro is smooth over short times, but a tiny bias, added up for minutes, becomes a big error. Each is good where the other is weak.
Worked example: Tilt
At rest: $a_x = 3.4$, $a_z = 9.2$ (m/sΒ²).
- $\arctan(3.4/9.2) \approx \arctan(0.37) \approx 20.3^\circ$.
Answer: About 20Β°.
Worked example: Drift
A gyro bias of 0.05 Β°/s, added up for 10 minutes.
- $0.05 \times 600 = 30^\circ$.
Answer: 30Β° of false turn.
Common mistake
Trusting the accelerometer while the robot speeds up, or the gyro's angle after a long time.