EKF: When commencing GPS aiding, don't reset local position and velocity if using optical flow

This commit is contained in:
Paul Riseborough 2016-03-10 15:14:50 +11:00
parent 26238bc2f5
commit 109e0e6dfc

View File

@ -121,12 +121,15 @@ void Ekf::controlFusionModes()
_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 the heading is valid start using gps aiding
if (_control_status.flags.yaw_align) {
resetPosition();
resetVelocity();
_control_status.flags.gps = true;
_time_last_gps = _time_last_imu;
// if we are not already aiding with optical flow, then we need to reset the position and velocity
if (!_control_status.flags.opt_flow) {
_control_status.flags.gps = resetPosition();
_control_status.flags.gps = resetVelocity();
}
}
}