Skip to content

Fix FastSLAM resampling state and landmark copies - #1514

Open
Elon-Jiang wants to merge 1 commit into
AtsushiSakai:masterfrom
Elon-Jiang:fix/fastslam-resampling-copies
Open

Elon-Jiang wants to merge 1 commit into
AtsushiSakai:masterfrom
Elon-Jiang:fix/fastslam-resampling-copies

Conversation

@Elon-Jiang

Copy link
Copy Markdown

Reference issue

No matching open Issue or PR found. Checked all 75 open PR file lists, complete resampling/symbol searches and the full history of both FastSLAM source files.

What does this implement/fix?

FastSLAM 1/2 resampling takes a shallow list snapshot, then changes the same particle objects while still reading parents from that snapshot. A 100-particle posterior with weights 0.4 and 0.6 on particles 0 and 1 collapses to 100 copies of particle 0, instead of 40/60 copies of the two states. The selected landmark arrays also remain shared between offspring, so one particle's landmark update changes other hypotheses.

Deep-copy the parent snapshot before writing any output, and copy each offspring's landmark and covariance arrays. Preserve particle/list identities, weighting, resampling schedule and public signatures. Update the existing FastSLAM explanation and its illustrative snapshot.

This intentionally corrects the numerical pose/map results after resampling. Each particle again holds the independent belief documented by FastSLAM. Both implementations are fixed together.

Additional information

Normal repository imports and pinned requirements on Python 3.13.11, macOS arm64. Real Particle, resampling and landmark-update functions run; no replacement algorithm, simulator or hardware is used.

  • Original source: 4 failed, 2 passed (uniform-weight controls), with the existing simulations deselected.
  • Fixed focused tests, including the existing unanimated simulations: 8 passed, warnings treated as errors. New tests cover pose/map/covariance parent preservation, independent landmark updates and unchanged uniform-weight particles.
  • bash runtests.sh: 162 passed in 100.09 s, including changed-file Ruff, type checks and warnings-as-errors, with BLAS/OMP threads limited to one.
  • Ruff on all changed Python files and git diff --check: passed.
  • make html with the repository's warnings-as-errors setting: passed; generated content and parent navigation checked.

Prepared and tested with assistance from OpenAI Codex.

CheckList

  • Did you add an unittest for your new example or defect fix?
  • Did you add documents for your new example? (Updated existing official pages.)
  • All CIs are green? (Hosted CI pending.)

Co-authored-by: OpenAI Codex <noreply@openai.com>

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