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

MulticopterLandDetector: Make land detection time configurable #17440

Merged
merged 3 commits into from
May 4, 2021

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Apr 21, 2021

Describe problem solved by this pull request

  1. Land detector trigger times are hardcoded values:
    The tree stages used arbitrary 350, 250 300ms totally 900ms
  2. It's hard and error-prone to debug the land detector when you have to calculate each condition manually at every point in time.
  3. An efficiently designed multirotor commanded to hold constant altitude but moving fast horizontally can during hard braking maneuvers hit the limit of low thrust because of the additional lift generated by the horizontal movement airflow around the (rather large) propellers. In that case it often has worse altitude tracking and the position controller demands additional downwards velocity to reach the right altitude again. This is with the current land detector implementation intentionally interpreted as the intent to descend with the vehicle. It's done that way to implicitly allow to land by moving the position setpoint into the ground without setting a vertical velocity setpoint but we don't use this method of landing anymore for quite a while now.

Describe your solution

  1. Make the total land detection time configurable and each stage a fraction of it.
    By default 1 second -> 333ms per stage.
  2. I ported @RomanBapst 's commit to log the necessary flags to easily understand what's going from a log.
  3. I switch the descend detection to look at the trajectory's velocity setpoint to eliminate the problem. During a hard brake with too much lift all the flags about low thrust, movement might go to true but if there's no intent to descend landing will not be detected. This has the disadvantage that landing with an altitude setpoint only that is moving into the ground is not possible anymore. Wherever that might occur. We could in principle add an extra condition for that case but I didn't do that here.

Test data / coverage

  1. SITL tested with output of the concrete us value and testing with 1 second and 10 second trigger time.
  2. Log shows all the flags correctly, we use that for quite some time now.
  3. I SITL tested and any normal, expected way of landing uses a downwards velocity setpoint and works exactly like before.

Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

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

Cool stuff, I agree that we need the land duration setting exposed, as this can be an easy to use setting to reduce the amount of false positives for land detection on low throttle systems.

@MaEtUgR MaEtUgR force-pushed the land-detector-variable-time branch from 0f477a1 to d9aed0c Compare April 27, 2021 14:48
@MaEtUgR MaEtUgR changed the title MulticopterLandDetector: Make land detection time configurable [WIP] MulticopterLandDetector: Make land detection time configurable Apr 29, 2021
…d contact state

Signed-off-by: RomanBapst <bapstroman@gmail.com>
@MaEtUgR MaEtUgR force-pushed the land-detector-variable-time branch from d9aed0c to 90139c6 Compare April 30, 2021 16:33
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Apr 30, 2021

Thanks for all the good reviews! I tested the configurable time and in decend changes also on a real vehicle and followed up on the review comments.

Because #17403 was quickly merged in between I had to slightly change the distance sensor logic to apply the parameter changes in a consistant way:
3f2c631#diff-13eefebea7bf72c2fa6a4192610df3e813b41098dff9b4b9c55c7cdb77ae0554R105-R110

It would really be better to keep these things separate since they are in principle used by the multicopter land detector only.

Ready for final review?

@MaEtUgR MaEtUgR changed the title [WIP] MulticopterLandDetector: Make land detection time configurable MulticopterLandDetector: Make land detection time configurable Apr 30, 2021
sfuhrer
sfuhrer previously approved these changes May 3, 2021
MaEtUgR added 2 commits May 4, 2021 10:25
The tree stages used arbitrary 350, 250 300ms totally 900ms
So this changes it to each stage to a third of the parameter.
Default it is 1 second -> 333ms per stage.
For any normal use case where a downwards velocity setpoint is set
this works exactly the same as before.
E.g. autonomous landing, landing in Altitude or Position mode

The advantage is that the very common case where a vehicle tries
to hold a constant altitude but fails to do so e.g. during a hard brake
with too much lift the resulting downwards velocity was interpreted
as descend intent and since the vehicle already struggled to hold altitude
with low thrust and was not moving fast anymore because it was braking
this lead to a lot more false positives on certain vehicle types.

The disadvantage is that not setting a downwards velocity setpoint but
just moving the position setpoint into the ground does not result in
land detection anymore. We do not use this method of landing anymore for
quite a while. It's not recommended and I wonder if there's some rare use
case like offboard where this is done.

We could add an additional case for the specific case to land with a
position setpoint only.
@MaEtUgR MaEtUgR force-pushed the land-detector-variable-time branch from 90139c6 to 5e9b873 Compare May 4, 2021 08:26
@MaEtUgR
Copy link
Member Author

MaEtUgR commented May 4, 2021

How was I able to commit with a style check failing missing newline 🙈
https://github.com/PX4/PX4-Autopilot/compare/90139c680c2bad342e539678134a4fb8b492796c..5e9b873481d2ea88462bf3ac81c27f05db15aca1

@MaEtUgR
Copy link
Member Author

MaEtUgR commented May 4, 2021

Merging since it was reviewed before adding the empty line for style.

@MaEtUgR MaEtUgR merged commit c285336 into master May 4, 2021
@MaEtUgR MaEtUgR deleted the land-detector-variable-time branch May 4, 2021 14:43
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