-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add DEBUG_POS_EST logging for position residual debugging #11225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sensei-hacker
wants to merge
1
commit into
iNavFlight:maintenance-9.x
Choose a base branch
from
sensei-hacker:debug-position-residual-logging
base: maintenance-9.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+14
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -692,7 +692,20 @@ static bool estimationCalculateCorrection_XY_GPS(estimationContext_t * ctx) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ctx->accBiasCorr.y += (gpsPosYResidual * sq(w_xy_gps_p) + gpsVelYResidual * sq(w_xy_gps_v)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Adjust EPH */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ctx->newEPH = updateEPE(posEstimator.est.eph, ctx->dt, MAX(posEstimator.gps.eph, gpsPosResidualMag), w_xy_gps_p); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const float gps_eph_input = MAX(posEstimator.gps.eph, gpsPosResidualMag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ctx->newEPH = updateEPE(posEstimator.est.eph, ctx->dt, gps_eph_input, w_xy_gps_p); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // DEBUG: GPS update metrics for Issue #11202 investigation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // These override the position/velocity debug values during GPS updates (~5Hz) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Provides critical data: position residual, GPS weight, unfiltered EPH input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG_SET(DEBUG_POS_EST, 0, (int32_t)(posEstimator.gps.eph * 100)); // GPS EPH from receiver (cm) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG_SET(DEBUG_POS_EST, 1, (int32_t)(gps_eph_input * 100)); // Unfiltered EPH input = MAX(GPS_eph, residual) (cm) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG_SET(DEBUG_POS_EST, 2, (int32_t)(gpsPosResidualMag * 100)); // Position residual magnitude (cm) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG_SET(DEBUG_POS_EST, 3, (int32_t)(w_xy_gps_p * 10000)); // GPS position weight × 10000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG_SET(DEBUG_POS_EST, 4, (int32_t)(gpsPosXResidual)); // Position residual X (cm) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG_SET(DEBUG_POS_EST, 5, (int32_t)(gpsPosYResidual)); // Position residual Y (cm) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG_SET(DEBUG_POS_EST, 6, (int32_t)(posEstimator.est.eph * 100)); // Current estimated EPH before update (cm) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG_SET(DEBUG_POS_EST, 7, (int32_t)(ctx->newEPH * 100)); // New EPH after filtering (cm) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+701
to
+708
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Protect the debug casts by checking for non-finite values and clamping to
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: To ensure consistency with the comment indicating centimeters, multiply
gpsPosXResidualandgpsPosYResidualby 100 before casting them for the debug output. [possible issue, importance: 7]