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.
This commit is contained in:
Mathieu Bresciani
2025-03-05 16:37:26 +01:00
committed by GitHub
parent 2aecdfe116
commit 0ab3e45c13
@@ -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);