Skip to content

IMU

Conceptual

An IMU (Inertial Measurement Unit) measures linear acceleration and angular velocity, enabling robots to estimate their orientation and motion. IMUs are essential for state estimation, complementing cameras and LiDAR by providing high-rate proprioceptive data.

┌─────────────────────────────────────┐
│ IMU │
│ ┌───────────┐ ┌───────────────┐ │
│ │Accelero- │ │ Gyroscope │ │
│ │meter (3) │ │ (3-axis) │ │
│ │ │ │ │ │
│ │ ax ay az │ │ ωx ωy ωz │ │
│ └───────────┘ └───────────────┘ │
│ Optional: │
│ ┌───────────────────────────────┐ │
│ │ Magnetometer (3-axis) │ │
│ │ mx my mz │ │
│ └───────────────────────────────┘ │
└─────────────────────────────────────┘
  • Accelerometer: Measures linear acceleration (m/s²)
  • Gyroscope: Measures angular velocity (rad/s)
  • Magnetometer: Measures magnetic field (compass heading)

An IMU with magnetometer is sometimes called an AHRS (Attitude and Heading Reference System).

Measures specific force (acceleration + gravity).

Reading = True Acceleration - Gravity
At rest: a = [0, 0, 9.81] m/s² (standing upright)

Use: Tilt sensing, vibration, step counting

Measures angular velocity around each axis.

Reading = [ωx, ωy, ωz] rad/s (roll rate, pitch rate, yaw rate)

Use: Orientation tracking, stabilization

Problem: Drift — small errors accumulate over time

Measures magnetic field (mostly Earth’s).

Reading = [mx, my, mz] μT

Use: Heading/yaw reference

Problem: Easily disturbed by nearby metal, electronics

SpecDescriptionGood Value
Noise densitySensor noise level<0.1 mg/√Hz (accel), <0.01°/s/√Hz (gyro)
Bias stabilityHow much bias drifts<10 μg (accel), <1°/hr (gyro)
Sample rateOutput frequency100-1000 Hz
RangeMaximum measurable±16g, ±2000°/s
GradeUse CaseGyro BiasCost
ConsumerPhones, toys10-100°/hr$1-10
IndustrialDrones, robots1-10°/hr$50-500
TacticalNavigation, surveying0.1-1°/hr$1,000-10,000
NavigationAircraft, ships<0.01°/hr$10,000+

Raw IMU data drifts over time. Fusion with other sensors corrects this:

Simple, fast — blend gyro (short-term accurate) with accel (long-term accurate):

# Complementary filter for pitch
alpha = 0.98
pitch = alpha * (pitch + gyro_rate * dt) + (1-alpha) * accel_pitch

Optimal fusion, handles noise models:

┌────────────┐ ┌────────────┐
│ IMU │ ──► │ │
└────────────┘ │ Kalman │ ──► State Estimate
┌────────────┐ │ Filter │ (position, velocity,
│ GPS / │ ──► │ │ orientation)
│ Camera/ │ │ │
│ LiDAR │ └────────────┘
└────────────┘

Fuse IMU with camera — gold standard for robot state estimation.

Tools: VINS-Mono, ORB-SLAM3, Isaac ROS Visual SLAM

ChipGradeNotes
MPU-6050ConsumerVery cheap, adequate for simple projects
BMI088IndustrialGood for drones
ICM-42688-PIndustrialLow noise, Jetson-compatible
ADIS16470TacticalHigh accuracy, SPI interface

Standard message: sensor_msgs/Imu

# IMU message fields:
orientation # Quaternion (if filter provides)
angular_velocity # rad/s (gyro)
linear_acceleration # m/s² (accel)
Terminal window
# Start IMU driver (varies by hardware)
ros2 launch imu_driver imu.launch.py
# View data
ros2 topic echo /imu/data
PackagePurpose
robot_localizationEKF/UKF sensor fusion
imu_filter_madgwickOrientation from IMU
imu_complementary_filterSimple orientation filter
isaac_ros_visual_slamVIO with GPU acceleration (Isaac ROS 4.0)

IMUs require calibration for best accuracy:

  • Scale factor: Correct gain errors
  • Bias: Remove constant offset
  • Axis misalignment: Correct non-orthogonal axes
  • Bias: Remove constant offset (changes with temperature!)
  • Scale factor: Correct gain
  • Hard iron: Remove constant offset (nearby magnets)
  • Soft iron: Correct for nearby metals distorting field
  • SLAM — Visual-Inertial SLAM
  • LiDAR — Complementary sensor
  • Cameras — VIO fusion partner