From a461bb971ad66fc1ce502707d04a2accba80eac2 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Wed, 4 Aug 2021 18:55:51 +0200 Subject: [PATCH] FlightTask: preserve vertical velocity during reactivation to allow descending by stick for reliable land detection. Issue: Stick smoothing gets completely reset to state when not taken off -> downwards velocity setpoint is gone when not taken off -> in_descend flag of land detection is never true when not taken off -> when landing but falling out of landing it landing detection fails bafore taking off and landing again --- .../flight_mode_manager/tasks/FlightTask/FlightTask.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/flight_mode_manager/tasks/FlightTask/FlightTask.cpp b/src/modules/flight_mode_manager/tasks/FlightTask/FlightTask.cpp index 2e48160b59..3aa8cf899a 100644 --- a/src/modules/flight_mode_manager/tasks/FlightTask/FlightTask.cpp +++ b/src/modules/flight_mode_manager/tasks/FlightTask/FlightTask.cpp @@ -20,7 +20,10 @@ bool FlightTask::activate(const vehicle_local_position_setpoint_s &last_setpoint void FlightTask::reActivate() { - activate(empty_setpoint); + // Preserve vertical velocity while on the ground to allow descending by stick for reliable land detection + vehicle_local_position_setpoint_s setpoint_preserve_vertical{empty_setpoint}; + setpoint_preserve_vertical.vz = _velocity_setpoint(2); + activate(setpoint_preserve_vertical); } bool FlightTask::updateInitialize()