Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Ardupilot/ardupilot/llms.txt
Use this file to discover all available pages before exploring further.
AP_InertialSensor (accessed globally as AP::ins()) is the central library that manages every accelerometer and gyroscope connected to an ArduPilot autopilot. It loads hardware-specific backends at startup, applies calibration offsets and scale factors, runs configurable low-pass and harmonic notch filters, collects delta-angle and delta-velocity integrals for the EKF, and exposes all IMU data through a unified API. The EKF, attitude controller, and vibration monitor all depend on this library.
Supported IMU hardware
ArduPilot ships backend drivers for a broad range of inertial sensors. Detection is automatic based on the hardware definition for the target board.InvenSense / TDK
MPU-6000, MPU-9250, ICM-20608, ICM-20689, ICM-42688-P, ICM-42605. The ICM-42688 is the most common sensor on modern flight controllers.
Bosch / STMicro
BMI055, BMI088, LSM9DS0, L3GD20. Often found on integrated autopilots where multiple IMU types are fitted for voting.
Analog Devices
ADIS16375, ADIS16470. Tactical-grade IMUs used on high-end platforms where low noise and thermal stability are critical.
Kistler / H3LIS / IIM-42652
High-g accelerometers and specialised sensors for platforms experiencing shock loads above 16 g.
External AHRS
Accepts IMU data forwarded from an external AHRS system (e.g., VectorNav, MicroStrain) through
AP_ExternalAHRS.SITL simulation
A software simulated IMU backend is used in the software-in-the-loop simulator for development and testing.
Key API methods
All IMU data is accessed through the singleton. The primary instance is selected internally; overloads that accept auint8_t i argument allow per-instance access when multiple IMUs are present.
get_gyro() — angular rate
get_gyro() — angular rate
get_accel() — linear acceleration
get_accel() — linear acceleration
get_delta_angle() — integrated rotation
get_delta_angle() — integrated rotation
update() call and the time interval over which it was collected (delta_angle_dt in seconds). Used directly by the EKF for attitude prediction. Returns false if no new data is available.get_delta_velocity() — integrated acceleration
get_delta_velocity() — integrated acceleration
update() and the corresponding time interval. Used by the EKF for velocity and position prediction. Returns false if no new data is available.get_gyro_health() and get_accel_health()
get_gyro_health() and get_accel_health()
true if the specified sensor is producing valid data and has not exceeded its error threshold. get_gyro_health_all() and get_accel_health_all() check every registered instance.healthy()
healthy()
true only when both the primary gyro and the primary accel are healthy. Used in pre-arm checks and failsafe monitoring.get_gyro_count() and get_accel_count()
get_gyro_count() and get_accel_count()
get_gyro_rate_hz() and get_accel_rate_hz()
get_gyro_rate_hz() and get_accel_rate_hz()
get_vibration_levels()
get_vibration_levels()
Sampling rates and filtering
AP_InertialSensor is initialised with a target loop rate and automatically configures backends to over-sample and then filter down to the requested rate.
Low-pass filter
A second-order Butterworth filter with cutoff frequency set by
INS_GYRO_FILTER (gyro) and INS_ACCEL_FILTER (accel). Default is 20 Hz for gyro on most vehicles. Lower values reduce noise but increase phase lag, which can affect attitude control.IMU calibration
Accelerometer calibration (ACCEL_CAL)
ArduPilot uses a Gauss-Newton six-position calibration routine to compute per-axis offset and scale factor for each accelerometer. Calibration is performed through Mission Planner, QGroundControl, or the MAVLinkMAV_CMD_PREFLIGHT_CALIBRATION command.
Calibration data is stored in the INS_ACC*_* parameter group and applied automatically at startup.
Gyroscope calibration
Gyro offsets are re-estimated at every startup from a 5-second still period (controlled byINS_GYRO_CAL). The offsets are stored in INS_GYROFFS_* parameters.
Temperature calibration (
INS_TCAL_*) can be enabled to compensate for bias drift across temperature ranges, which is important on vehicles that fly in varying ambient temperatures.Multiple IMU voting
When several IMUs are present, the EKF runs a separate prediction lane for each one (controlled byEK3_IMU_MASK). The IMU health flags reported by get_gyro_health() and get_accel_health() allow faulty sensors to be excluded.
The INS_USE parameter controls which IMU instances are included in the primary data path:
INS_USE bit | Effect |
|---|---|
1 | Include IMU 1 in the active set |
2 | Include IMU 2 in the active set |
4 | Include IMU 3 in the active set |
_first_usable_gyro, _first_usable_accel) based on the lowest healthy instance index in the active set.
Usage example
Related parameters
| Parameter | Description |
|---|---|
INS_GYRO_FILTER | Gyro low-pass filter cutoff frequency (Hz) |
INS_ACCEL_FILTER | Accel low-pass filter cutoff frequency (Hz) |
INS_GYRO_CAL | Gyro calibration timing (0 = never, 1 = startup only) |
INS_USE / INS_USE2 / INS_USE3 | Enable/disable individual IMU instances |
INS_FAST_SAMPLE | Bitmask enabling high-rate sensor sampling per instance |
INS_HNTCH_ENABLE | Enable harmonic notch filter |
INS_HNTCH_FREQ | Notch centre frequency (Hz) |
INS_HNTCH_MODE | Notch tracking mode (fixed, throttle, RPM, FFT) |
INS_ACCOFFS_* | Accelerometer offset calibration values |
INS_ACCSCL_* | Accelerometer scale calibration values |
INS_GYROFFS_* | Gyro offset calibration values |