Skip to content

fix(stick_yaw): reset yaw setpoint when unaided yaw recovers#27411

Open
AkaiEurus wants to merge 1 commit into
PX4:mainfrom
AkaiEurus:fix-stick-yaw-unaided-yaw-recovery
Open

fix(stick_yaw): reset yaw setpoint when unaided yaw recovers#27411
AkaiEurus wants to merge 1 commit into
PX4:mainfrom
AkaiEurus:fix-stick-yaw-unaided-yaw-recovery

Conversation

@AkaiEurus
Copy link
Copy Markdown
Contributor

Solved Problem

Fixes a yaw setpoint discontinuity in StickYaw when unaided_yaw recovers after being unavailable.

#25710 fixed the finite-to-NaN transition by preserving _yaw_correction while unaided_yaw is not available. However, when unaided_yaw becomes finite again, the yaw correction logic can still use stale yaw error filter/reference state from before the outage. This can apply an invalid correction delta to the locked yaw setpoint.

Solution

Track whether unaided_yaw was invalid during the previous update. When it becomes valid again, reset the yaw error filter/reference to the current yaw error, clear the stale correction state, and force the yaw lock to reinitialize from the current yaw.

Added a regression test covering the finite -> NaN -> finite transition to ensure the yaw setpoint does not jump when unaided_yaw recovers.

Changelog Entry

For release notes:

Bugfix: avoid yaw setpoint jumps when unaided yaw recovers in StickYaw

Test coverage

make tests TESTFILTER=StickYaw

@github-actions github-actions Bot added kind:bug Something is broken or behaving incorrectly. kind:test Adds or improves tests. scope:testing Unit, integration, fuzzing, or test data. labels May 20, 2026
@bresch bresch requested a review from MaEtUgR May 20, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug Something is broken or behaving incorrectly. kind:test Adds or improves tests. scope:testing Unit, integration, fuzzing, or test data.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants