Browse Source

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.
mission-4.1.18
priseborough 9 years ago committed by Andrew Tridgell
parent
commit
bd7bf21475
  1. 8
      libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp

8
libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp

@ -185,7 +185,13 @@ void NavEKF2_core::readMagData() @@ -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;
}
}
}

Loading…
Cancel
Save