Skip to main content

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.

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.
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.
1

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.
2

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.
3

Set external compass orientation (if applicable)

If you are using a GPS module with a built-in compass (common for multicopters), set the External Compass Orientation to match how that module is mounted on the airframe.
An incorrect orientation setting causes the EKF2 filter to receive sensor data that conflicts with the vehicle’s actual motion, resulting in poor attitude estimation and potential loss of control. Verify orientation before any first flight.

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.
1

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.
2

Start calibration

Click Compass on the Sensors page, then click OK to begin. QGC displays the six orientations you need to complete.
3

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.
4

Confirm and save

Once all six orientations are complete, click OK. PX4 computes the hard-iron offsets and saves them as CAL_MAG* parameters.
If the compass calibration repeatedly fails, check that the GPS/compass module is mounted as far from battery cables and ESCs as possible. Even a few centimeters of additional separation can dramatically reduce hard-iron interference.

Gyroscope calibration

The gyroscope measures rotation rate. Calibration removes the static bias (the offset reading when the sensor is perfectly still).
1

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.
2

Start calibration

Click Gyroscope on the Sensors page, then click OK. Calibration takes only a few seconds.
3

Hold still until complete

QGC shows a progress bar while it samples the gyroscope at rest. The calibrated bias values are saved as CAL_GYRO* parameters.

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.
1

Start calibration

Click Accelerometer on the Sensors page, then click OK.
2

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)
3

Confirm and save

After all six positions are sampled, QGC computes and saves the calibration to CAL_ACC* parameters.
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.
1

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.
2

Run calibration

Click Level Horizon on the Sensors page, then click OK. PX4 records the current attitude as the neutral reference and saves offsets to SENS_BOARD_X_OFF and SENS_BOARD_Y_OFF.

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_REF controls 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.
1

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.
2

Cover the pitot opening

QGC instructs you to cover the opening. Use a finger or a small cap to block airflow completely.
3

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.
4

Uncover the opening

Remove your finger or cap when prompted. Blow gently across the pitot opening to verify the airspeed reading responds correctly.

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.
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.
For typical recreational multicopter use at consistent ambient temperatures, standard calibration is sufficient.
After thermal calibration, all subsequent standard calibrations update the TC_* thermal compensation parameters rather than the legacy CAL_* offset parameters. This is expected behavior.

Build docs developers (and LLMs) love