AP_NavEKF2: Speed improve switch-over to backup magnetometer

When switching over to a back up magnetometer, ensure that the earth field estimate are reset. other wise mag earth field estimates due to the previous failed mag could cause data from the new mag to be rejected.
This commit is contained in:
priseborough 2016-07-18 23:25:56 +10:00 committed by Andrew Tridgell
parent e34cdc6666
commit bd7bf21475

View File

@ -185,7 +185,13 @@ void NavEKF2_core::readMagData()
stateStruct.body_magfield.zero();
// clear the measurement buffer
storedMag.reset();
}
// clear the data waiting flag so that we do not use any data pending from the previous sensor
magDataToFuse = false;
// request a reset of the magnetic field states
magStateResetRequest = true;
// declare the field unlearned so that the reset request will be obeyed
magFieldLearned = false;
}
}
}