The calibration failed: the compass does not face the way its settings say
What ArduPilot says:
- Mag(N) bad orientation: N/N N.N
- Mag(N) internal bad orientation: N N.N
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
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.
The attitude used to judge the compass is wrong: the accelerometers are not calibrated, or
AHRS_ORIENTATIONdoes 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.A compass on a cable is treated as internal, so its orientation may not be corrected.
Check
COMPASS_EXTERNAL(COMPASS_EXTERN2for 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_ROT2 the orientation is then found and saved.COMPASS_AUTO_ROTis 1: the orientation is checked but never corrected.FixSet
COMPASS_AUTO_ROTto 2 and calibrate again, or enter the orientation from the message inCOMPASS_ORIENTyourself.
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
| Parameter | What it is |
|---|---|
COMPASS_AUTO_ROT | Automatically check orientation |
COMPASS_ORIENT | Compass orientation |
COMPASS_EXTERNAL | Compass is attached via an external cable |
AHRS_ORIENTATION | Board Orientation |
COMPASS_ORIENT2 | Compass2 orientation |
COMPASS_EXTERN2 | Compass2 is attached via an external cable |
Where to do it:Setup & Tuning GuideSetup & Tuning GuideSetup & Tuning Guide
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