Skip to content

Commit

Permalink
MC auto: improve behavior of RC help during landing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bresch authored Mar 5, 2025
1 parent 2aecdfe commit 0ab3e45
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0ab3e45

Please sign in to comment.