From ef7ade52b15369d43df156049870e14d6aa06ba4 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 13 Dec 2016 23:13:31 +0100 Subject: [PATCH] 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. --- src/modules/mc_pos_control/mc_pos_control_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp index 8cc4fdf9c2..52c3277ff9 100644 --- a/src/modules/mc_pos_control/mc_pos_control_main.cpp +++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp @@ -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; }