EKF: Don't use optical flow if GPS is good and the vehicle is not using range finder for height

This commit is contained in:
Paul Riseborough
2018-05-08 08:42:03 +10:00
parent 389786ef1b
commit 82de3141f0
+6 -1
View File
@@ -352,9 +352,14 @@ void Ekf::controlOpticalFlowFusion()
} }
} else { } else {
_time_bad_motion_us = 0; // inhibit flow use if GPS quality is good and we are not using range aiding
// this enables use of optical flow to improve station keeping when low and slow
if (_control_status.flags.gps && (_time_last_imu - _last_gps_fail_us > (uint64_t)5e6) && !_in_range_aid_mode) {
_time_bad_motion_us = _imu_sample_delayed.time_us;
} else {
_time_good_motion_us = _imu_sample_delayed.time_us; _time_good_motion_us = _imu_sample_delayed.time_us;
} }
}
// Inhibit flow use if on ground and motion is excessive // Inhibit flow use if on ground and motion is excessive
// Apply a time based hysteresis to prevent rapid mode switching // Apply a time based hysteresis to prevent rapid mode switching