commander: fix bug in pos vel validity transition

This ensures that a mode change will occur immediately when the EKF reports the solution as invalid.
This commit is contained in:
Paul Riseborough 2017-05-05 07:48:37 +10:00 committed by ChristophTobler
parent d31ee73354
commit b85c8fa135
1 changed files with 1 additions and 1 deletions

View File

@ -3783,7 +3783,7 @@ check_posvel_validity(bool data_valid, float data_accuracy, float required_accur
// Check accuracy with hysteresis in both test level and time // Check accuracy with hysteresis in both test level and time
bool pos_status_changed = false; bool pos_status_changed = false;
if (*valid_state && data_accuracy > required_accuracy * 2.5f) { if (*valid_state && ((data_accuracy > required_accuracy * 2.5f) || !data_valid)) {
pos_inaccurate = true; pos_inaccurate = true;
pos_status_changed = true; pos_status_changed = true;
*last_fail_time_us = now; *last_fail_time_us = now;