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

Airspeed Selector: do not run it within the first 2s after system boot #14811

Merged
merged 1 commit into from
May 6, 2020

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented May 2, 2020

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).

#14807

Describe problem solved by this pull request
In SITL, the airspeed selector has a false positive at startup (probably because there is no airspeed data yet), causing it to first switch to airspeed index -1 (airspeed invalid), and then to 1 (airspeed valid) a bit later once data is there.

Describe your solution
Do not run the airspeed selector as long as hrt_absolute_time() is below 2s.

Describe possible alternatives
Fix it on the SITL airspeed driver side (or if it's not that then find root cause). I think though that waiting 2s after boot until you have an airspeed reading isn't that bad either.

Test data / coverage
SITL tested.

Additional context
#14254 would extend the current preflight checks to prevent arming if the airspeed selector is not up yet or not yet publishing an airspeed (which in this case would be within the 2s after boot).

@dagar is using hrt_absolute_time the proper time measure for this or would there be something more appropriate? When exactly does it actually start counting (when is hrt_absolute_time =0)?

@dagar
Copy link
Member

dagar commented May 6, 2020

This could be fine as a quick fix for NuttX, although I was wondering if we can do a cleaner job initializing in the first place.

@dagar is using hrt_absolute_time the proper time measure for this or would there be something more appropriate? When exactly does it actually start counting (when is hrt_absolute_time =0)?

Fairly early in system init right before rcS is executed. Note it doesn't start at 0 on Linux.

@sfuhrer sfuhrer marked this pull request as ready for review May 6, 2020 11:08
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 <silvan@auterion.com>
@sfuhrer sfuhrer force-pushed the pr-fix-airspeed-error-detection-at-boot branch from 05f3776 to c072d75 Compare May 6, 2020 15:08
@dagar dagar merged commit 45ebbb8 into master May 6, 2020
@dagar dagar deleted the pr-fix-airspeed-error-detection-at-boot branch May 6, 2020 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants