Skip to content

Commit

Permalink
AirspeedValidator: Remove extra delay from airspeed innovation check (#…
Browse files Browse the repository at this point in the history
…23244)

* AirspeedValidator: remove additional one second of hysteresis for triggering
innovation checks

- this check already uses an integrator and so adding more delay just makes
log analysis more difficult and does not really add any value

Signed-off-by: RomanBapst <[email protected]>

* removed unnecessary conditions

Signed-off-by: RomanBapst <[email protected]>

* AirspeedValidator: only disable innov checks if ASPD_FS_INTEG is negative

Signed-off-by: Silvan Fuhrer <[email protected]>

* get rid of unnecessary check on innovation threshold parameter

Signed-off-by: RomanBapst <[email protected]>

---------

Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: Silvan Fuhrer <[email protected]>
Co-authored-by: Silvan Fuhrer <[email protected]>
  • Loading branch information
RomanBapst and sfuhrer authored Jun 11, 2024
1 parent 9ececfd commit 8ad9346
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 2 additions & 9 deletions src/modules/airspeed_selector/AirspeedValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,13 @@ AirspeedValidator::check_airspeed_innovation(uint64_t time_now, float estimator_
}

// reset states if check is disabled, we are not flying or wind estimator was just initialized/reset
if (!_innovation_check_enabled || !_in_fixed_wing_flight || (time_now - _time_wind_estimator_initialized) < 5_s
|| _tas_innov_integ_threshold <= 0.f) {
if (!_innovation_check_enabled || !_in_fixed_wing_flight || (time_now - _time_wind_estimator_initialized) < 5_s) {
_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 +246,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 = _aspd_innov_integ_state > _tas_innov_integ_threshold;
}

_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

0 comments on commit 8ad9346

Please sign in to comment.