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

land detector and hysteresis cleanup #9157

Closed
wants to merge 3 commits into from
Closed

land detector and hysteresis cleanup #9157

wants to merge 3 commits into from

Conversation

dagar
Copy link
Member

@dagar dagar commented Mar 25, 2018

A large portion of the intermittent CI failures seem to be related to the land detector.

Debugging...

@dagar dagar force-pushed the pr-land_detector branch 2 times, most recently from f91d6fa to 887c411 Compare March 25, 2018 20:20
@dagar dagar force-pushed the pr-land_detector branch from 1024cf8 to 43fb27e Compare March 26, 2018 03:22
@dagar
Copy link
Member Author

dagar commented Mar 26, 2018

The VTOL land detector airspeed filtered is occasionally getting stuck infinite.

http://ci.px4.io:8080/blue/organizations/jenkins/Firmware/detail/PR-9157/38/pipeline

INFO  [land_detector] _airspeed_filtered: inf

@lamping7 FYI

@dagar dagar force-pushed the pr-land_detector branch from b3aab7c to c905c76 Compare March 26, 2018 04:22
@dagar dagar mentioned this pull request Mar 26, 2018
const float alt_max = _get_max_altitude();

if (landDetected != landed_state_init) {
PX4_ERR("landDetected: %d landed_state_init: %d", landDetected, landed_state_init);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

These if statements are probably not what you want.
You will get an PX4_ERR message every single time the get_..._state() is true but the corresponding hysteresis not.

@dagar
Copy link
Member Author

dagar commented Mar 26, 2018

@lamping7 20/20 full CI passes.

@dagar
Copy link
Member Author

dagar commented Mar 26, 2018

These if statements are probably not what you want.

Yes, it was crappy debugging code to try and catch something that was only failing in the CI system intermittently.

image

@dagar dagar force-pushed the pr-land_detector branch from 576edcb to aee32f4 Compare March 26, 2018 12:51
@dagar
Copy link
Member Author

dagar commented Mar 26, 2018

@Stifael what do you think about publishing each land detector state separately like this? I did it for debugging a failure, but I'm wondering if it's worth keeping.

@dagar
Copy link
Member Author

dagar commented Mar 26, 2018

Airspeed finite checks removed from this PR and merged in #9163.

@dagar
Copy link
Member Author

dagar commented Mar 26, 2018

For the land detector I'd still like to discuss the need to hold and publish a single state at a time.

https://github.com/PX4/Firmware/blob/25300a6b11ae5d363b2eafe24718d44c454a859e/src/modules/land_detector/LandDetector.cpp#L195-L209

Internally the land detector is a number of different booleans (landed, maybe_landed, ground_contact, freefalling), and it publishes the same booleans, but only one active at a time.

The vehicle_land_detected message should either publish all of these booleans or a single a state.

@dagar dagar removed bug Hybrid VTOL 🛩️🚁 Multirotor + Fixedwing! labels Mar 26, 2018
@dagar dagar changed the title [WIP] Pr land detector land detector and hysteresis cleanup Mar 26, 2018
@dagar dagar dismissed Stifael’s stale review March 26, 2018 14:04

debugging code removed

@lamping7
Copy link
Member

It makes sense to have it as you have done here because for MC the only thing stopping multiple states from being active at once is the loosely coupled check for the previous state at the end of each respective state getter, excluding freefall which is seperate. It could help future debugging if something changes for the worse.

Changing the message to send one value for the state could be done with refactoring to other modules that use the message (Commander and mc pos ctl), but the state machine that is the land detector should probably be modified to ensure only one can be active, with tighter transition control. On the other hand much of this makes no sense for fixed wing, or even rover which serves no purpose at all.

@Stifael
Copy link
Contributor

Stifael commented Mar 26, 2018

The vehicle_land_detected message should either publish all of these booleans or a single a state.

I vote for all. If the vehicle is landed, then for sure it is also maybe landed and also has ground contact and therefore it makes sense to capture that in the code implementation as well.
In addition, I remember that at some point the landdetector was planned to become a vehicle-model specific module. If that is still the case, then I think it makes even more sense to allow multiple boolean states to be true at the same time.
I think for MC it would require a few changes outside of the landdetector.

@lamping7
Copy link
Member

A downside to doing this, showing ground contact and maybe landed, is that they need to be checked in the correct order in the mc pos controller, altering thrust, which is not clear unless you know how this works.

@Stifael
Copy link
Contributor

Stifael commented Mar 26, 2018

That should not be a problem. During ground contact the thrust in xy is turned off, and during maybe landed the entire thrust vector is set to 0. This means it does not even require an if-elseif statement

@dagar dagar force-pushed the pr-land_detector branch from 7cdcdfe to d571478 Compare April 12, 2018 05:14
@dagar dagar force-pushed the pr-land_detector branch from d571478 to 48252aa Compare April 17, 2018 17:01
@stale
Copy link

stale bot commented Jan 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@lamping7
Copy link
Member

Has this been superseded?

@stale stale bot removed the Admin: Wont fix label Jan 24, 2019
@dagar dagar closed this Feb 5, 2019
@dagar dagar deleted the pr-land_detector branch February 5, 2019 21:20
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.

3 participants