Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AirspeedValidator: Remove extra delay from airspeed innovation check #23244

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/modules/airspeed_selector/AirspeedValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,11 @@ AirspeedValidator::check_airspeed_innovation(uint64_t time_now, float estimator_
if (!_innovation_check_enabled || !_in_fixed_wing_flight || (time_now - _time_wind_estimator_initialized) < 5_s
|| _tas_innov_integ_threshold <= 0.f) {
_innovations_check_failed = false;
_time_last_tas_pass = time_now;
_aspd_innov_integ_state = 0.f;

} else if (!lpos_valid || estimator_status_vel_test_ratio > 1.f || estimator_status_mag_test_ratio > 1.f) {
//nav velocity data is likely not good
//don't run the test but don't reset the check if it had previously failed when nav velocity data was still likely good
_time_last_tas_pass = time_now;
_aspd_innov_integ_state = 0.f;

} else {
Expand All @@ -249,11 +247,7 @@ AirspeedValidator::check_airspeed_innovation(uint64_t time_now, float estimator_
_aspd_innov_integ_state = 0.f;
}

if (_tas_innov_integ_threshold > 0.f && _aspd_innov_integ_state < _tas_innov_integ_threshold) {
_time_last_tas_pass = time_now;
}

_innovations_check_failed = (time_now - _time_last_tas_pass) > TAS_INNOV_FAIL_DELAY;
_innovations_check_failed = _tas_innov_integ_threshold > 0.0f && _aspd_innov_integ_state > _tas_innov_integ_threshold;
RomanBapst marked this conversation as resolved.
Show resolved Hide resolved
}

_time_last_aspd_innov_check = time_now;
Expand Down
2 changes: 0 additions & 2 deletions src/modules/airspeed_selector/AirspeedValidator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ class AirspeedValidator
float _tas_innov_threshold{1.0}; ///< innovation error threshold for triggering innovation check failure
float _tas_innov_integ_threshold{-1.0}; ///< integrator innovation error threshold for triggering innovation check failure
uint64_t _time_last_aspd_innov_check{0}; ///< time airspeed innovation was last checked (uSec)
uint64_t _time_last_tas_pass{0}; ///< last time innovation checks passed
float _aspd_innov_integ_state{0.0f}; ///< integral of excess normalised airspeed innovation (sec)
static constexpr uint64_t TAS_INNOV_FAIL_DELAY{1_s}; ///< time required for innovation levels to pass or fail (usec)
uint64_t _time_wind_estimator_initialized{0}; ///< time last time wind estimator was initialized (uSec)

// states of load factor check
Expand Down
Loading