diydrones/ardupilot — pull request #1652 by priseborough (2014-12-02 08:39:41+00:00)
Title: AP_NavEKF: Reduce vulnerability to ground fixed magnetic interference

This fixes a vulnerability to bad ground based magnetic interference observed here:

https://groups.google.com/forum/#!topic/drones-discuss/3dTM3rjpcNE

Re-initialisation of the magnetic field states and yaw angle is now only performed a maximum of two times after start-up.

- Once when coming out of static modefor the first time (first arm event)
- Again (for copter only) when the altitude gain above the arming altitude exceeds 1.5m

This prevents magnetic interference present at arming (eg arming on a metal roof)from corrupting the magnetic field states enough to cause bad heading errors and toilet bowling on copter.
It also prevents learned compass and earth field offsets being discarded each time the vehicle lands and is disarmed, helping with accuracy for users doing multiple short missions on the one battery pack