mc_pos_control: stay landing even after freefall

This fixes the following case:
1. VTOL in auto mission descends to land
2. _in_landing is set to true correctly
3. _lnd_reached_ground is set to true because it's detected, motors idle.
4. The vehicle might drop for a few centimeters and _acc_z_lp goes back
   up above 4m/s^2, so freefall is detected.
5. The motors spin up again, and _in_landing and _lnd_reached_ground are
   both reset to false.
6. Since we're floating at a few centimeters, we can't actyally get to
   _vel_z_lp > 0.5, and therefore _in_landing is never triggered after.
7. Thus we never finish the landing.

This is fixed by only resetting _lnd_reached_ground to false but
leaving _in_landing true.
This commit is contained in:
Julian Oes
2016-12-13 23:13:31 +01:00
committed by Lorenz Meier
parent 70fec788d9
commit ef7ade52b1
@@ -1875,7 +1875,7 @@ MulticopterPositionControl::control_position(float dt)
&& (_acc_z_lp > 4.0f
|| _vel_z_lp > 2.0f * _params.land_speed)) {
thr_max = _params.thr_max;
_in_landing = false;
_in_landing = true;
_lnd_reached_ground = false;
}