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

Multicopter land detector - Add robustifying condition #11167

Closed
wants to merge 1 commit into from

Conversation

bresch
Copy link
Member

@bresch bresch commented Jan 8, 2019

Description

This shortcut comes from the fact that "When landed and that the thrust is low, the drone has to be on the ground"

This also fixes a bug in jMavSim where the takeoff delay parameter MPC_IDLE_TKO was ignored due to false takeoff detection.

False takeoff detection also occurs in real life when the baro and/or GPS wrongly drive the velocity estimate to a value above the detection threshold.

SITL tests

Manual position control
Before:
land_detector_before_manual
As soon as the vehicle is armed, takeoff is detected

After:
land_detector_after_manual
Even the large vz estimate error, takeoff is only detected when the throttle is high enough.

Mission
Before:
land_detector_before
Note that the delay between idle (actuator outputs at 900ms [0.9 on the graph]) and takeoff is ignored. We don't even see the actuators going to 900ms.
After:
land_detector_after
Note the delay of 3 seconds between idle and takeoff. The actuator output first goes to 0.9 (900ms) during those 3 seconds defined by MPC_IDLE_TKO.

@bresch bresch requested a review from RomanBapst January 8, 2019 11:18
@LorenzMeier LorenzMeier requested a review from a team January 8, 2019 11:23
@bresch bresch requested a review from MaEtUgR January 9, 2019 13:13
@bresch
Copy link
Member Author

bresch commented Jan 9, 2019

As you are currently in the land detector with #11172 can you check this PR as well? Thanks

@bresch bresch removed the request for review from RomanBapst January 9, 2019 13:15
@dannyfpv
Copy link

dannyfpv commented Jan 9, 2019

@MaEtUgR MaEtUgR requested a review from Stifael January 13, 2019 12:54
MaEtUgR
MaEtUgR previously approved these changes Jan 13, 2019
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

I totally see how this can make sense, still I'm constantly thinking about how it can be simplified or what is broken such that it's needed.
It's basically introducing different conditions to fall out of the landed state compared to switching into it. In detection you require the estimated speeds to be within thresholds to fall out only the thrust.
Do we generally need that? Can we structure the code simpler to make these cases clear?

src/modules/land_detector/MulticopterLandDetector.cpp Outdated Show resolved Hide resolved
@MaEtUgR MaEtUgR dismissed their stale review January 13, 2019 13:13

I still don't really understand

@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 13, 2019

Your thorough description of how you found out with MPC_IDLE_TKO lead me to do tests myself. I don't think it's false takeoff detection but rather false application of the hysteresis and hence a bug in the position controller.

I sometimes see the problem in jMAVSim and I'd even have a possible fix but I want to be able to test that it's fixed for sure but can't reproduce the problem all the time.

@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 13, 2019

@bresch I think I fixed the root cause in #11206, can you please check?

@Stifael
Copy link
Contributor

Stifael commented Jan 13, 2019

@bresch I like this change.
As a side comment: with

This shortcut comes from the fact that "When ground has been detected and that the thrust is low, the drone has to be on the ground"

I guess you meant "When landed was detected and the thrust is low, then the drone has to be on ground". That is also what you have implemented here

@bresch
Copy link
Member Author

bresch commented Jan 16, 2019

@MaEtUgR I moved the condition to _get_landed_state()

@bresch
Copy link
Member Author

bresch commented Jan 28, 2019

@MaEtUgR Can we merge that? @RomanBapst Tested it and it seems to reject bad velocity estimates that would trigger a takeoff detection.

@LorenzMeier
Copy link
Member

Can you please rebase so that CI is re-run?

@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 28, 2019

I can accept it because it's not wrong. I'm only hesitant because it could cover up other fundamental issues that have more impact when we have to discover them in a different way.

For example:

I think both might go unnoticed and would later cause other unexpected symptoms.

…hrottle is low to avoid detecting takeoff due to measurement and estimation inaccuracies
@dagar dagar added this to the Release v1.9.0 milestone Jan 30, 2019
@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 31, 2019

There's a new example: #11331 (comment)
It looks like he manages to get all the way into landed state and if you then stay there until there's a thrust command which is only given under certain takeoff conditions because it's in landed state there's a very good chance the drone would fall from the sky...

@bresch
Copy link
Member Author

bresch commented Jan 31, 2019

In those cases, freefall detection (that works really well) saves you from falling like a stone. Remember that the freefall detection has the highest priority.

Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

We can try.

  • As I mentioned it's not wrong and has the big advantage that there's no way the vehicle kicks out of the landed state while no takeoff action happens e.g. when someone knocks the drone over while it's armed on the ground and estimates overshoot it will not suddenly try to go into hover.
  • We should just be aware of a certain risk because falling out of a false positive landed state in air is not given anymore.
  • Also it might cover some existing or upcoming problems with the takeoff.

@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 31, 2019

@bresch Freefall failed on me once before back in #6550.
The drone fell 15 meters until I finally reacted by manually pushing the throttle up again just before it hit the ground. It might work today though... did you test? 😉

@dagar
Copy link
Member

dagar commented Feb 6, 2019

@MaEtUgR @bresch what would you like to do here?

@MaEtUgR
Copy link
Member

MaEtUgR commented Mar 1, 2019

The problem @bresch described in the description was solved by #11206. I see it like the case this pr helps is when you arm the drone, want to let it sit there in idle and it takes off prematurely because it gets moved hard enough. But the logic is this way to prevent a crash when false detecting a landing in air. So I'm concerned about a case the drone detects landing to the last stage in air and doesn't get out anymore because the position controller is holding the thrust low thinking it's landed.

@bresch
Copy link
Member Author

bresch commented Mar 2, 2019

I will close this PR since it's not really needed yet. If we discover that we have some false positive takeoff detections, we can still reopen it or discuss about an other solution.

@bresch bresch closed this Mar 2, 2019
@LorenzMeier LorenzMeier deleted the pr-lndmc-takeoff branch January 18, 2021 14:33
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.

6 participants