EKF: Re-align yaw and magnetic field states when changing into GPS aiding mode

This commit is contained in:
Paul Riseborough
2016-02-14 22:01:53 +01:00
committed by Roman
parent c089079321
commit 22c177c951
+7 -1
View File
@@ -57,9 +57,15 @@ void Ekf::controlFusionModes()
if (!_control_status.flags.gps) {
if (_control_status.flags.tilt_align && (_time_last_imu - _time_last_gps) < 5e5 && _NED_origin_initialised
&& (_time_last_imu - _last_gps_fail_us > 5e6)) {
_control_status.flags.gps = true;
// Reset the yaw and magnetic field states
_control_status.flags.yaw_align = resetMagHeading(_mag_sample_delayed.mag);
// If the heading is valid, reset the positon and velocity and start using gps aiding
if (_control_status.flags.yaw_align) {
resetPosition();
resetVelocity();
_control_status.flags.gps = true;
}
}
}