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_Baro is the front-end library that manages every barometric pressure sensor attached to an ArduPilot autopilot. It loads the correct backend driver at startup, performs ground-level calibration, applies temperature compensation, optionally corrects for aerodynamic pressure induced by airspeed or propeller wash, and exposes altitude, pressure, and temperature to the rest of the flight stack. The EKF, AHRS, and all altitude-holding flight modes consume baro data exclusively through this interface.
Supported sensors
ArduPilot detects and loads barometer drivers automatically at boot. The following hardware is supported:MS5611 / MS5607 / MS5637
High-resolution sensors widely used on Pixhawk-family flight controllers. MS5607 mode is selectable via the
BARO_OPTIONS parameter.BMP280 / BMP388 / BMP581
Bosch sensors common on budget and integrated boards. BMP388 and BMP581 offer improved noise characteristics.
SPL06 / DPS310
Infineon/XENSIV sensors with low noise floor, used in newer autopilots and companion boards.
LPS25H / FBM320 / MS5837
Specialised sensors including the MS5837 for underwater depth measurement on ArduSub platforms.
DroneCAN
Receives barometer data over a CAN bus from DroneCAN peripheral nodes.
External AHRS / MSP
Accepts baro data forwarded from an external AHRS system or MSP telemetry source.
The flight controller’s internal barometer is probed first. External I²C barometers can be enabled by setting bits in the
BARO_PROBE_EXT bitmask parameter. Up to three barometer instances (BARO_MAX_INSTANCES = 3) can run simultaneously.Calibration
AP_Baro calibrates on the ground before arming. Calibration records the current pressure and temperature as the reference point, so all subsequent altitude readings are relative to the takeoff location.
ground_pressure for each instance. After calibration, get_altitude() returns altitude relative to that ground pressure using the International Standard Atmosphere (ISA) model. Call update_calibration() to refresh the reference point in-flight (used by some modes to correct baro drift).
Key API methods
Access the global instance throughAP::baro(). Methods with no argument use the primary barometer; most have an overload that accepts a uint8_t instance index.
get_altitude() — relative altitude
get_altitude() — relative altitude
get_altitude_AMSL() — altitude above mean sea level
get_altitude_AMSL() — altitude above mean sea level
get_altitude() plus the GND_ALT_OFFSET field elevation parameter. Useful when the launch site elevation above MSL is known.get_pressure() — raw pressure
get_pressure() — raw pressure
get_temperature() — sensor temperature
get_temperature() — sensor temperature
get_climb_rate() — vertical speed
get_climb_rate() — vertical speed
get_altitude(). Positive values indicate climbing. This is a raw baro-only estimate; prefer the EKF climb rate for flight control.healthy() — sensor health
healthy() — sensor health
true if the sensor has produced a reading within the last 500 ms (BARO_TIMEOUT_MS). all_healthy() checks every registered instance.num_instances() — registered sensor count
num_instances() — registered sensor count
init().get_ground_pressure() and get_ground_temperature()
get_ground_pressure() and get_ground_temperature()
calibrate() call. Valid only after calibration.Airspeed and wind pressure correction
In fast-moving aircraft the static port is affected by dynamic pressure from airspeed and propeller thrust, causing the barometer to read a false altitude.AP_Baro supports two compensation mechanisms:
- Wind compensation (HAL_BARO_WIND_COMP_ENABLED)
- Thrust compensation (AP_BARO_THST_COMP_ENABLED)
Applies a correction proportional to dynamic pressure derived from the vehicle’s airspeed vector. The scaling coefficients are tuned per axis via the
GND_WCOEF_* parameter group.Atmospheric model
AP_Baro implements the 1976 US Standard Atmosphere model for altitude–pressure conversion. Helper functions are available for SITL and advanced use:
Usage example
Multiple barometers and primary selection
When more than one barometer is registered,AP_Baro designates a primary instance. You can override it with the BARO_PRIMARY parameter or call set_primary_baro() programmatically.
EK3_ALT_SOURCE is changed and the EKF is reconfigured.
Related parameters
| Parameter | Description |
|---|---|
BARO_PRIMARY | Primary barometer instance index |
BARO_PROBE_EXT | Bitmask enabling external I²C barometer probing |
GND_ALT_OFFSET | Field elevation offset for AMSL altitude |
GND_TEMP | User override of ground temperature for EAS2TAS |
BARO_FILTER | Outlier rejection filter range (in standard deviations) |
GND_WCOEF_* | Wind-induced pressure correction coefficients |
GND_TCOMP_SCALE | Thrust-compensation pressure scaling factor |
BARO_OPTIONS | Option flags (e.g., treat MS5611 as MS5607) |