The magnetic field the compass measures is too strong or too weak
What ArduPilot says:
- PreArm: Check mag field: N.N, max N, min N
With the offsets taken off, the first compass in use should read the Earth's magnetic field alone: ArduPilot expects about 530 milligauss and accepts 185 to 875. The message gives the value it sees, then the two limits. A reading outside them means the compass is measuring something besides the Earth, or instead of it.
What to do, most likely first
You are next to steel or a magnet: a car, a metal table, reinforced concrete, a speaker.
CheckCarry the aircraft a few metres into the open and watch the number in the message change.
FixArm, and calibrate, away from metal. A field that is right outdoors and wrong on the workbench needs no fixing.
The calibration is wrong: made near metal, or copied from another aircraft.
Check
COMPASS_OFS_X,COMPASS_OFS_YandCOMPASS_OFS_Zshift every reading; values that came from a parameter file were measured on another compass.FixCalibrate again outdoors, then reboot.
A magnet or a wire carrying current sits close to the compass on the aircraft.
CheckWith the aircraft still, switch equipment on and off (lights, video transmitter) and watch the raw compass values.
FixMove the compass away from power wiring and magnets, or use the external one.
The sensor reads on the wrong scale, or has failed.
CheckThe value stays far off wherever you go, even after a fresh calibration.
FixCalibrate with a GPS fix, so that ArduPilot can set
COMPASS_SCALEfrom the field expected at your location. If the field is still out of range, replace the compass.
Parameters to look at
| Parameter | What it is |
|---|---|
COMPASS_OFS_X | Compass offsets in milligauss on the X axis |
COMPASS_OFS_Y | Compass offsets in milligauss on the Y axis |
COMPASS_OFS_Z | Compass offsets in milligauss on the Z axis |
COMPASS_SCALE | Compass1 scale factor |
COMPASS_EXTERNAL | Compass is attached via an external cable |
Where to do it:Setup & Tuning Guide
The code that sends it
PreArm: Check mag field: N.N, max N, min N
libraries/AP_Arming/AP_Arming.cpp AP_Arming::compass_checks() · Open in ArduPilot Copter-4.7.1