fix(ekf2): hard reset external position estimate while position aiding active#27856
Open
haumarco wants to merge 1 commit into
Open
fix(ekf2): hard reset external position estimate while position aiding active#27856haumarco wants to merge 1 commit into
haumarco wants to merge 1 commit into
Conversation
Contributor
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 32 byte (0 %)]px4_fmu-v6x [Total VM Diff: 32 byte (0 %)]Updated: 2026-07-10T07:00:40 |
bresch
approved these changes
Jul 14, 2026
bresch
left a comment
Member
There was a problem hiding this comment.
So external pos aiding becomes external pos reset if another source of position is active; si it gets the absolute priority over everything else. I guess that's fin as long as we only use it for manual position updates (i.e.: only a couple of updates, not an external sensor with a constant update rate)
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.
Solved Problem
Since #25223,
MAV_CMD_EXTERNAL_POSITION_ESTIMATEis also executed while a horizontal position source (GNSS, EV, AGP, beacon) is being fused. In that case the command takes the reset-by-fusion path introduced in #25885, which applies the innovation with an artificially high Kalman gain and deliberately pushes it into the correlated states.This is correct during dead reckoning (large position variance, innovation reflects accumulated state error), but harmful with an active position source: the position variance is small, so the gain into correlated states is large, and the innovation is typically caused by a bias of the aiding source rather than by state error. In a real flight this yanked the velocity state by ~18 m/s from an 83 m position innovation, which then caused airspeed and position fusion to be gate-rejected.
Solution
Route the command to the hard-reset branch whenever
isHorizontalPositionAidingActive()is true. The hard reset translates the position, keeps velocity (minus wind), and zeroes wind with inflated variance. Reset-by-fusion remains in place for its intended dead-reckoning use case.Changelog Entry
For release notes:
Test coverage
Tested in SITL