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.

What’s Inside an IMU

┌─────────────────────────────────────┐
│ 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).

Sensor Characteristics

Accelerometer

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

Gyroscope

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

Magnetometer

Measures magnetic field (mostly Earth’s).

Reading = [mx, my, mz] μT

Use: Heading/yaw reference

Problem: Easily disturbed by nearby metal, electronics

Key Specifications

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

IMU Grades

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+

Sensor Fusion

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

Complementary Filter

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

Kalman Filter / EKF

Optimal fusion, handles noise models:

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

Visual-Inertial Odometry (VIO)

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

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

Common IMU Chips

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

ROS 2 Integration

Standard message: sensor_msgs/Imu

# IMU message fields:
orientation # Quaternion (if filter provides)
angular_velocity # rad/s (gyro)
linear_acceleration # m/s² (accel)

Launch Example

Terminal window
# Start IMU driver (varies by hardware)
ros2 launch imu_driver imu.launch.py
# View data
ros2 topic echo /imu/data

Fusion Packages

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)

Calibration

IMUs require calibration for best accuracy:

Accelerometer

  • Scale factor: Correct gain errors
  • Bias: Remove constant offset
  • Axis misalignment: Correct non-orthogonal axes

Gyroscope

  • Bias: Remove constant offset (changes with temperature!)
  • Scale factor: Correct gain

Magnetometer

  • 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

Sources