fix(tools): correct s6_inspect PSD check and NIS headline#423
Merged
Conversation
The S6 inspector reported two misleading diagnostics on real EuRoC data, both measurement artifacts rather than filter faults: 1. psd_after used is_positive_definite (bare Cholesky), which fails on any zero eigenvalue. The MSCKF covariance is legitimately rank-deficient: the newest clone is a stochastic copy of the IMU pose (exact zero-covariance directions) and the 4-DoF gauge (yaw + global position) is unobservable, so those eigenvalues sit at 0 +/- machine-eps. Full-window updates nudged them slightly positive (Cholesky passed) while partial-window updates left them at +/-1e-17 (Cholesky tripped) -> a deterministic, spurious "100% non-PSD on partial tracks" signal (eigendecomposition: min eig -1.1e-17, 6 eigenvalues ~0). Switched to is_positive_semidefinite, the invariant the Joseph form actually guarantees; the non-PSD warning drops from 18% to 0 on MH_02. 2. The NIS/dof headline averaged over all valid updates including the chi2-gated outlier tail (rejected, never applied), reading ~4.0 and printing "over-confident (R under-modeled)". The applied (accepted) updates are consistent (accepted NIS/dof 0.28 on MH_02). Now reports accepted-only as the honest per-update metric and keeps all-valid as a labelled secondary. #212 system-level over-confidence is a state-NEES property measured end-to-end, not from these innovation residuals. Inspector gate test passes (gcc + clang); no SDK/backend change. Relates to #371, #380, #212 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
Summary
While running the S6 inspector on real EuRoC to root-cause the VIO pipeline, two of its diagnostics turned out to be measurement artifacts, not filter faults. This corrects both. No SDK/backend change — the filter math was right.
The two artifacts
1. Spurious "non-PSD" on partial-window tracks
psd_afterusedis_positive_definite(bare Cholesky), which rejects any zero eigenvalue. But the MSCKF covariance is legitimately rank-deficient:Those eigenvalues sit at
0 ± machine-eps. Full-window updates nudged them slightly positive (Cholesky passed); partial-window updates left them at±1e-17(Cholesky tripped) — producing a deterministic, false "100% non-PSD on partial tracks / 18% overall" signal. Eigendecomposition of a flagged covariance: min eigenvalue −1.1e-17, 6 eigenvalues ≈ 0, all in the gauge / clone-copy directions.Fix: use
is_positive_semidefinite(the invariant the Joseph form actually guarantees). Non-PSD warning drops 18% → 0 on MH_02_easy.2. NIS headline dominated by the gated outlier tail
The
NIS/dofheadline averaged over all valid updates including χ²-gated outliers (rejected, never applied), reading ~4.0 and printing "over-confident (R under-modeled)". The updates the filter actually applied are consistent — accepted NIS/dof = 0.28 on MH_02.Fix: report accepted-only as the honest per-update consistency metric; keep all-valid as a clearly-labelled secondary. (#212 system-level over-confidence is a state-NEES property, measured end-to-end by
vio_pipeline, not from these innovation residuals.)Validation
Changes
tools/include/branes/tools/s6_update_inspect.hpp—is_positive_definite→is_positive_semidefinite; field comment corrected.tools/src/s6_inspect.cpp— accepted-only NIS accumulator + corrected headline.Test Results
Test plan
Relates to #371, #380, #212
🤖 Generated with Claude Code