From 3e149ee6c53cd8726c59d3de0fbfad98416dd0bf Mon Sep 17 00:00:00 2001 From: alessandro <3762382+potaito@users.noreply.github.com> Date: Tue, 7 Feb 2023 18:07:26 +0100 Subject: [PATCH] FlightTaskAuto: landing position updates for precision landing (#20951) - precision landing works incorrectly, target position is not updated during the descent above target - _prepareLandSetpoints needs to update _land_position continuously Co-authored-by: kapacheuski --- .../flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp index 19b7298fef..c1e4e096e8 100644 --- a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp +++ b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp @@ -229,12 +229,14 @@ void FlightTaskAuto::_prepareLandSetpoints() } if (_type_previous != WaypointType::land) { - // initialize xy-position and yaw to waypoint such that home is reached exactly without user input - _land_position = Vector3f(_target(0), _target(1), NAN); + // initialize yaw _land_heading = _yaw_setpoint; _stick_acceleration_xy.resetPosition(Vector2f(_target(0), _target(1))); } + // Update xy-position in case of landing position changes (etc. precision landing) + _land_position = Vector3f(_target(0), _target(1), NAN); + // User input assisted landing if (_param_mpc_land_rc_help.get() && _sticks.checkAndUpdateStickInputs()) { // Stick full up -1 -> stop, stick full down 1 -> double the speed