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

[WIP] Improve robustness to bad and lost airspeed data #11846

Merged
merged 8 commits into from
Apr 30, 2019
Merged

Conversation

dagar
Copy link
Member

@dagar dagar commented Apr 14, 2019

Continuation of #10733

@dagar
Copy link
Member Author

dagar commented Apr 14, 2019

I'm not sure that I like commander taking on a stall speed and load factor calculation, but I don't have an immediate alternative to suggest architecturally.

We already have this accelerated stall logic in the FW position controller, although it was done with the minimum airspeed (to avoid parameterizing a stall speed). Ideally this will all be handled in the same place.

https://github.com/PX4/Firmware/blob/d36b06f779d49d8dc7387bf2b4fa3aade999ada3/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp#L482-L496

// Do actions based on value of COM_ASPD_FS_ACT parameter
status.aspd_fault_declared = false;
status.aspd_use_inhibit = false;
status.aspd_fail_rtl = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are expected to be set on every iteration what's preventing spamming mavlink messages every iteration?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any of the fault conditions are triggered, then a fault tie is recorded here: https://github.com/PX4/Firmware/blob/a76726845a2299d7ea4da5c3b77a09f998fffe55/src/modules/commander/Commander.cpp#L4181

All faults have to clear for a minimum time here: https://github.com/PX4/Firmware/blob/a76726845a2299d7ea4da5c3b77a09f998fffe55/src/modules/commander/Commander.cpp#L4212

before fault_cleared can be set to true and _tas_use_inhibit is set to false.

Until this occurs, fault_declared cannot be set to true again which means that once a fault has been declared there is a minimum time of _tas_use_start_delay seconds before it can be cleared and re-declared.


/**
* RTL delay after bad airspeed measurements are detected if COM_ASPD_FS_ACT is set to 4. Ensure the COM_ASPD_STALL parameter is set correctly before use.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing short description.

@LorenzMeier
Copy link
Member

@RomanBapst Help with review and testing would be appreciated.

* @group Commander
*/
PARAM_DEFINE_INT32(COM_ASPD_FS_ACT, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TAS seems to be the more commonly used Param abbreviation for "airspeed". Should we rename this COM_TAS_FS_ACT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Antiheavy Antiheavy self-requested a review April 14, 2019 20:33
@priseborough
Copy link
Contributor

Looking through the logs supplied by @Antiheavy in #10733 I think there are changes to significantly reduce false positives associated with the use of the innovation check, eg:

  • Checking the time integral of the exceedance so that transient errors due to gusts can be rejected.
  • Improve initialisation of wind states. Currently they are initialised to zero with a small uncertainty of 1m/s and take time to learn.
  • Increasing the EKF2_EAS_NOISE parameter. This is currently set at 1.4 m/s which is too low for windy conditions

However the load factor test on its own is already providing significant improvement in protection against a FOD or water pitot blockage so if EKF checks were be turned off by default, then the change could be rolled in now and the estimator related work rolled in with a second PR.

  1. Extreme wind outside specified vehicle limits. Slow wind state learning contributes to test ratio failures during direction changes.
    Screen Shot 2019-04-22 at 10 53 44 am

  2. Windy weather inside vehicle limits. Wind vector converges sufficiently quickly this time.
    Screen Shot 2019-04-22 at 10 14 56 am

  3. EKF formed bad initial wind estimate.
    Screen Shot 2019-04-22 at 10 21 25 am

  4. Takeoff with pitot tube blocked with moisture:
    Screen Shot 2019-04-22 at 10 18 09 am

@Antiheavy
Copy link
Contributor

However the load factor test on its own is already providing significant improvement in protection against a FOD or water pitot blockage so if EKF checks were be turned off by default, then the change could be rolled in now and the estimator related work rolled in with a second PR.

This seems like a good idea for getting a basic and already tested safety feature implemented for v1.9

@LorenzMeier
Copy link
Member

@dagar Could you fix the compile error so we can get this in with checks being off by default?

Bringing stuff in but disabling it and collecting log data is the secret behind successful software development in a lot of industries, in particular in apps and web services.

@priseborough
Copy link
Contributor

I've added some changes that reduces the likelihood of false positives for users that want to try the innovation checks, but has them disabled by default so that if the user activates protection they will get the stall ratio test only unless they specifically set an innovation test ratio level.

By default protection and logging is off (COM_ASPD_FS_ACT = 0)

I will now add a patch that logs the required diagnostic data even when COM_ASPD_FS_ACT = 0

@dagar dagar self-assigned this Apr 24, 2019
@dagar dagar added this to the Release v1.9.0 milestone Apr 24, 2019
@dagar
Copy link
Member Author

dagar commented Apr 24, 2019

@dagar Could you fix the compile error so we can get this in with checks being off by default?

Yes I'll take another pass tomorrow.

@dagar
Copy link
Member Author

dagar commented Apr 29, 2019

I've added "(Experimental)" to all the parameter names and moved them to the "Developer" category.

priseborough and others added 7 commits April 30, 2019 02:34
Use the time integral of the exceedance to improve rejection of gust induced transients.
Previous implementation could trigger above 0.7 * COM_TAS_FS_INNOV so fix scaling so that test ratios below COM_TAS_FS_INNOV cannot trigger.
Change to an integer representation for the the threshold parameter and enable innovation test to be disabled by setting the threshold parameter to 0.
Improve parameter documentation.
The airspeed innovation test is disabled by default.
Always log the consistency checked variable, even when disabled.
Revert the innovation threshold parameter back to a float to make its meaning more intuitive vs the estimator_status.tas_test_ratio it is compared against.
@dagar dagar marked this pull request as ready for review April 30, 2019 06:39
@dagar
Copy link
Member Author

dagar commented Apr 30, 2019

Merging this as discussed to facilitate more real world testing. Fair warning for any early adopters, I anticipate a bit of parameter naming churn.

@dagar dagar merged commit 9bad61b into master Apr 30, 2019
@dagar
Copy link
Member Author

dagar commented Apr 30, 2019

This is now in master, thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants