From 0ab3e45c13b603eaf867b7a341ab0eeafc4c92aa Mon Sep 17 00:00:00 2001 From: Mathieu Bresciani Date: Wed, 5 Mar 2025 16:37:26 +0100 Subject: [PATCH] MC auto: improve behavior of RC help during landing Letting the autopilot set the heading during landing while the pilot is nudging the vehile leads to a weird UX as the vehicle would make a turn instead of translating. With this modification, the initial land heading is immediately overridden when the pilot begins to adjust the drone's position, providing the sensation of full control. --- .../flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp index 556ac6c72e..5cb75222a0 100644 --- a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp +++ b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp @@ -253,9 +253,15 @@ void FlightTaskAuto::_prepareLandSetpoints() // Stick full up -1 -> stop, stick full down 1 -> double the speed vertical_speed *= (1 - _sticks.getThrottleZeroCenteredExpo()); + Vector2f sticks_xy = _sticks.getPitchRollExpo(); + + if (sticks_xy.longerThan(FLT_EPSILON)) { + // Ensure no unintended yawing when nudging horizontally during initial heading alignment + _land_heading = _yaw_sp_prev; + } + rcHelpModifyYaw(_land_heading); - Vector2f sticks_xy = _sticks.getPitchRollExpo(); Vector2f sticks_ne = sticks_xy; Sticks::rotateIntoHeadingFrameXY(sticks_ne, _yaw, _land_heading);