Fixed wing nav: reset WP cross-track tracking state on re-engagement#11640
Open
b14ckyy wants to merge 1 commit into
Open
Fixed wing nav: reset WP cross-track tracking state on re-engagement#11640b14ckyy wants to merge 1 commit into
b14ckyy wants to merge 1 commit into
Conversation
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Test firmware build ready — commit Download firmware for PR #11640 238 targets built. Find your board's
|
The fixed-wing waypoint cross-track controller (nav_fw_wp_tracking_accuracy) kept its rate/error state in function-local statics that were never reset. After a turn or loiter, where the controller is disengaged (needToCalculateCircularLoiter), the first sample on the next leg was computed from stale data from the previous leg, causing a small heading twitch when rejoining the course line. Re-seed the controller state to the current cross-track error while it is not actively steering, so it re-engages cleanly on the next leg.
4022174 to
9c40920
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes a brief, unnecessary heading twitch when a fixed-wing aircraft rejoins a
waypoint course line after a turn or loiter, with
nav_fw_wp_tracking_accuracy(waypoint course tracking) enabled.
Root cause
The cross-track controller in
updatePositionHeadingController_FW()keeps itsrate/error state in function-local
staticvariables (previousCrossTrackError,previousCrossTrackErrorUpdateTime,crossTrackErrorRateand the rate filter)that are never reset.
While the controller is disengaged — during a turn/loiter
(
needToCalculateCircularLoiter) or when the feature is off — that state freezes.On the next leg the first control sample is then computed against stale cross-track
data from the previous leg, producing a small heading kick as the aircraft
rejoins the new course line.
Fix
Re-seed the controller state to the current cross-track error whenever it is not
actively steering, so on re-engagement the error delta starts near zero and the
rate filter starts clean.
static) so the inactivebranch can reset them.
elsebranch that syncspreviousCrossTrackError/timestamp to thecurrent value, zeroes the rate, and resets the rate filter.
No new settings, no parameter-group change, no MSP/protocol change. No behavioural
change when
nav_fw_wp_tracking_accuracy = 0.Target branch
maintenance-9.x— backward-compatible bug fix per the branching guidelines.Propagates to
maintenance-10.xvia the normal merge-forward flow.Testing
nav_fw_wp_tracking_accuracyenabled, checking clean leg re-capture after turns/loiter.
Scope
Single focused fix in
navigation/navigation_fixedwing.c(~14 added / 5 removed).