← All tools

Message & Error Explainer

What an ArduPilot message means and what to do about it

Українська

The calibration failed: the compass does not face the way its settings say

Stops itCompass

What ArduPilot says:

At the end of a calibration ArduPilot tries every mounting orientation and keeps the one in which the Earth's field stays most constant as you turn the aircraft. The first number is the compass, counted from 0. “bad orientation: a/b c” means it could not choose between orientations a and b (c says how much better the best one fits). “internal bad orientation: a” means it found orientation a, different from the one set, but will not change it: the compass is internal, or COMPASS_AUTO_ROT is 1 (check only). Either way the calibration is rejected and usually starts again by itself.

What to do, most likely first

  1. The aircraft was not turned through enough orientations, or was calibrated next to steel.

    FixCalibrate outdoors and turn the aircraft slowly about every axis: nose down, nose up, each side down, upside down, with a full turn in each position.

  2. The attitude used to judge the compass is wrong: the accelerometers are not calibrated, or AHRS_ORIENTATION does not match how the board is mounted.

    CheckWith the aircraft level, the ground station's horizon is level; tilt the nose down and it shows nose down, roll right and it shows right.

    FixSet AHRS_ORIENTATION, reboot, calibrate the accelerometers, then calibrate the compass again.

  3. A compass on a cable is treated as internal, so its orientation may not be corrected.

    CheckCOMPASS_EXTERNAL (COMPASS_EXTERN2 for the second compass) is 0.

    FixSet it to 1, or to 2, which stops auto-detection from changing it; reboot and calibrate. With COMPASS_AUTO_ROT 2 the orientation is then found and saved.

  4. COMPASS_AUTO_ROT is 1: the orientation is checked but never corrected.

    FixSet COMPASS_AUTO_ROT to 2 and calibrate again, or enter the orientation from the message in COMPASS_ORIENT yourself.

The orientation numbers are COMPASS_ORIENT values (0 none, 2 Yaw90, 4 Yaw180, 6 Yaw270, 8 Roll180). A different orientation is accepted when it fits more than 4 times better than the next best, or more than 2 times when only quarter turns are compared.

Parameters to look at

ParameterWhat it is
COMPASS_AUTO_ROTAutomatically check orientation
COMPASS_ORIENTCompass orientation
COMPASS_EXTERNALCompass is attached via an external cable
AHRS_ORIENTATIONBoard Orientation
COMPASS_ORIENT2Compass2 orientation
COMPASS_EXTERN2Compass2 is attached via an external cable
The code that sends it

Mag(N) bad orientation: N/N N.N

libraries/AP_Compass/CompassCalibrator.cpp CompassCalibrator::calculate_orientation() · Open in ArduPilot Copter-4.7.1

Mag(N) internal bad orientation: N N.N

libraries/AP_Compass/CompassCalibrator.cpp CompassCalibrator::calculate_orientation() · Open in ArduPilot Copter-4.7.1

Written here for Copter 4.6. In the tool you choose your vehicle and version, see your own parameter values beside the ones named here, and drop a flight log to have every message in it explained.

Open it in the Message & Error Explainer