Skip to content

Fix double propagation in CKF prediction covariance - #1474

Open
Afloat16 wants to merge 1 commit into
AtsushiSakai:masterfrom
Afloat16:fix-ckf-single-step-covariance-20261026
Open

Afloat16 wants to merge 1 commit into
AtsushiSakai:masterfrom
Afloat16:fix-ckf-single-step-covariance-20261026

Conversation

@Afloat16

Copy link
Copy Markdown

Reference issue

No matching report or pull request was found for this covariance time-step defect.

What does this implement/fix?

f updates a sigma-point column in place. The mean loop in cubature_prediction therefore already stores the once-propagated points Y_i = f(X_i). The covariance loop called f on those columns again, accumulating second-step points around the first-step mean.

Reuse the stored one-step points for both weighted moments. The sigma-point rule and square root, weights, motion/measurement models, noise matrices, defaults and public API are unchanged.

The regressions check the exact affine yaw identity P_yaw_yaw' = P_yaw_yaw + 2*dt*P_yaw_rate + dt**2*P_rate_rate + Q_yaw_yaw, including negative, zero and positive prior correlation. Separate diagonal-prior cases independently integrate the circular displacement using midpoint heading and sinc, then check the complete predicted mean/covariance. Input and noise nonmutation, covariance symmetry and positive semidefiniteness are also checked.

Additional information

Validation on Linux / Python 3.13.5 with the repository-pinned requirements, including NumPy 2.5.3, SciPy 1.18.1 and Matplotlib 3.11.2:

  • Pristine original full bash runtests.sh: 156 passed.
  • Added regressions against pristine source: 11 failed, 1 original example control passed.
  • Fixed pytest tests/test_cubature_kalman_filter.py -q -Werror: 12 passed; an independent automated reviewer also ran these 12 tests successfully against the exact final files.
  • Final unchanged full bash runtests.sh: 167 passed, including its Ruff and nine-package mypy checks, with warnings treated as errors. Original tests, assertions, workloads and defaults are retained.
  • Ruff on both changed Python files, git diff --check and strict make -C docs html: passed. The existing Ruff configuration deprecation warning is unchanged.

Only the production CKF file and its existing test file change. The function docstring explains the state order, units and one-step prediction; no new example, RST page or visual asset is added.

The hosted Python 3.14 matrix, other operating systems and physical hardware were not executed locally. No hosted CI pass or human maintainer approval is claimed. The motion model's existing zero-turn behavior is outside this fix.

Prepared and tested with Codex assistance. Independent review and focused validation were automated, not a substitute for maintainer review.

CheckList

  • Added regression tests for the defect.
  • Added documents for a new example. (Not applicable; no new example. Existing function documentation clarified.)
  • All CIs are green? (Hosted checks have not run for this contribution yet.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant