Accurate sensor calibration is the foundation of stable, predictable flight. PX4 relies on its inertial measurement unit (IMU), magnetometer, and barometer to estimate attitude, heading, and altitude. If any of these sensors carry uncalibrated offsets or scale errors, the EKF2 navigation filter produces a degraded state estimate and the vehicle flies poorly or unsafely. This page explains how to calibrate each sensor type using QGroundControl and notes when advanced thermal calibration is appropriate.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/PX4/PX4-Autopilot/llms.txt
Use this file to discover all available pages before exploring further.
Complete sensor calibration after selecting the airframe and before configuring radio or flight modes. Re-run calibration any time you remount the flight controller, change the vehicle structure significantly, or move the vehicle to a very different climate.
Calibration overview
All standard calibrations are performed in QGroundControl > Vehicle Setup > Sensors. The sensors page lists each sensor with a status indicator showing whether calibration is complete. Work through the sensors in the order shown below, as some later calibrations depend on orientation being set correctly first.Sensor orientation
Before calibrating individual sensors, tell PX4 how the flight controller is physically mounted on the airframe.Open sensor orientation settings
Navigate to Vehicle Setup > Sensors > Sensor Orientation. If your flight controller is mounted in the standard orientation (arrow pointing forward, flat side up), leave all rotation values at ROTATION_NONE.
Set the board rotation
If the controller is rotated or tilted, select the matching rotation from the Autopilot Orientation dropdown. PX4 offers rotations in 45-degree increments for yaw, and standard 90-degree flips for pitch and roll.
Magnetometer (compass) calibration
The magnetometer measures the Earth’s magnetic field to provide heading information. Calibration removes the effect of hard-iron interference from motors, wiring, and the airframe structure.Move away from ferrous metal
Take the vehicle to a calibration area free from large metal objects, running motors, power cables, and other sources of magnetic interference. Indoor concrete floors are usually acceptable; avoid steel-framed buildings.
Start calibration
Click Compass on the Sensors page, then click OK to begin. QGC displays the six orientations you need to complete.
Rotate through all orientations
Hold the vehicle in each orientation shown (nose up, nose down, right side up, right side down, on its back, and upright) and rotate slowly in place through at least one full 360-degree turn. The progress indicator for each orientation fills as QGC collects enough samples.
Gyroscope calibration
The gyroscope measures rotation rate. Calibration removes the static bias (the offset reading when the sensor is perfectly still).Place the vehicle on a flat, stable surface
Set the vehicle down on a table or the ground where it will not vibrate or move. Do not touch it during calibration.
Start calibration
Click Gyroscope on the Sensors page, then click OK. Calibration takes only a few seconds.
Accelerometer calibration
The accelerometer measures specific force (gravity plus linear acceleration). The six-point calibration corrects for offset and scale factor errors on all three axes.Hold each of the six orientations
QGC highlights one orientation at a time and shows a silhouette of the vehicle. Hold the vehicle steady in the indicated orientation and click Next when the progress bar fills. The six orientations are:
- Level (top up)
- Nose down
- Tail down
- Left side down
- Right side down
- Upside down (top down)
Hold the vehicle as still as possible during each position. Even small vibrations add noise to the calibration samples and can degrade accuracy.
Level horizon calibration
Level horizon calibration tells PX4 what “level” looks like on a given airframe. It compensates for slight mounting tilt that accelerometer scale calibration cannot capture.Place the vehicle on a level surface
Use a spirit level to verify the surface is as flat as possible. The vehicle should be in its normal flight orientation with propellers removed.
Barometer
The barometer provides altitude estimates based on atmospheric pressure. PX4 does not require a separate barometer calibration step — it automatically establishes a ground-level reference on each boot and arm. However, keep the following in mind:- Do not block or expose the barometer opening to direct airflow. Most flight controllers include a foam filter over the barometer port to reduce dynamic pressure effects.
- Ground pressure changes with weather. EKF2 fuses barometer data with GPS altitude to reduce accumulated drift.
- The parameter
EKF2_HGT_REFcontrols whether barometer, GPS, range finder, or vision is used as the primary height source.
Airspeed sensor calibration (fixed-wing and VTOL)
Fixed-wing aircraft and VTOLs use a pitot-static tube to measure airspeed. The calibration zeros the differential pressure sensor at rest.Ensure the pitot tube is unobstructed
Point the pitot tube into the ambient air away from propeller wash or building HVAC vents. There should be no wind gusts during calibration.
Cover the pitot opening
QGC instructs you to cover the opening. Use a finger or a small cap to block airflow completely.
Start calibration
Click Airspeed on the Sensors page, then click OK. With the opening covered, PX4 measures the zero-wind bias and saves it to
SENS_DPRES_OFF.Thermal calibration
Standard calibration removes sensor bias at a single ambient temperature. If your vehicle operates across a wide temperature range — for example, taking off on a cold morning and climbing to altitude — temperature-induced bias drift can degrade state estimation. PX4 supports thermal calibration, which characterizes each sensor’s bias across a temperature sweep and stores polynomial correction coefficients (TC_* parameters). These corrections are applied automatically during flight whenever the sensor temperature changes.
- When to use thermal calibration
- Onboard calibration procedure
- Offboard calibration procedure
Thermal calibration is most beneficial for:
- Fixed-wing and VTOL vehicles that climb to altitude quickly (large temperature change).
- Vehicles operating in environments with temperature swings greater than ~20°C.
- High-accuracy applications such as surveying or precision delivery.
After thermal calibration, all subsequent standard calibrations update the
TC_* thermal compensation parameters rather than the legacy CAL_* offset parameters. This is expected behavior.