Skip to content

Commit

Permalink
Airspeed Selector: do not run it within the first 2s after system boot
Browse files Browse the repository at this point in the history
This is to prevent a wrong (false positive) failure detection of the airspeed
shortly after system boot due to delays in driver and/or estimator startup (seen in SITL).

Signed-off-by: Silvan Fuhrer <[email protected]>
  • Loading branch information
sfuhrer committed May 6, 2020
1 parent 604258e commit c072d75
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/modules/airspeed_selector/airspeed_selector_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ AirspeedModule::check_for_connected_airspeed_sensors()
void
AirspeedModule::Run()
{
_time_now_usec = hrt_absolute_time(); //hrt time of the current cycle

/* do not run the airspeed selector until 2s after system boot, as data from airspeed sensor
and estimator may not be valid yet*/
if (_time_now_usec < 2_s) {
return;
}

perf_begin(_perf_elapsed);

if (!_initialized) {
Expand All @@ -276,7 +284,7 @@ AirspeedModule::Run()
update_params();
}

_time_now_usec = hrt_absolute_time(); //hrt time of the current cycle


bool armed = (_vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED);

Expand Down

0 comments on commit c072d75

Please sign in to comment.