Skip to content

fix(ekf): plot_error in SLAM, against time, honouring bgcolor, with correct bounds - #749

Merged
petercorke merged 4 commits into
mainfrom
bug/ekf-plot-error
Oct 14, 2026
Merged

petercorke merged 4 commits into
mainfrom
bug/ekf-plot-error

Conversation

@petercorke

@petercorke petercorke commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

EKF.plot_error() had several defects:

  • the error subtracted the whole state vector from the 3-element true pose, so it raised for SLAM (state is pose plus landmarks)
  • the error line was plotted against sample index on axes limited to time (set_xlim(0, t[-1])), so only the first part of a run was visible
  • bgcolor was documented but ignored; the polygon was always red
  • the bound used chi-squared with 2 degrees of freedom for a scalar error, so the shaded region was 2.45 sigma instead of the 1.96 sigma of a 95% interval. This changes what the plot shows: Figure 6.10 of RVC3 was made with the wider bound (checked by regenerating it: the x band peaks at 0.479 with 2 degrees of freedom and 0.384 with 1, and the stored figure's is about 0.48). Decided to keep the correction; it is recorded in a versionchanged:: 1.4.5 note in the docstring and in the changelog highlights, and the RVC3 errata will note it
  • confidence=None computed chi2.ppf(None) and failed
  • a map-only filter has no pose estimate; it now raises a clear ValueError
  • the ax parameter is now documented and a stray backtick is fixed

Six tests are added (five fail without the fix) and the expectedFailure on #747 is removed.

Stacked on #747. Base this PR on main once #747 has merged.

🤖 Generated with Claude Code

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 17 complexity · 1 duplication

Metric Results
Complexity 17
Duplication 1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

petercorke and others added 3 commits October 14, 2026 09:44
…orrect bounds

- the error subtracted the whole state vector from the 3-element true pose,
  which raised for SLAM where the state also holds the landmarks
- the error was plotted against sample index on axes limited to time, so only
  the first part of the run was visible
- bgcolor was documented but ignored (the polygon was always red)
- the bounds used chi-squared with 2 degrees of freedom for a scalar error, so
  the shaded region was 2.45 sigma rather than the 1.96 sigma of a 95% interval
- confidence=None computed chi2.ppf(None) and failed
- raise a clear ValueError for a map-only filter, which has no pose estimate
- document the ax parameter, fix a stray backtick

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d changelog

The bounds were drawn at the radius of a two-dimensional confidence region,
which is too wide for a scalar error; the figure in RVC3 (Fig 6.10) was made
that way.  Record the change, and that earlier plots differ, in a
versionchanged note and in the changelog highlights.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@petercorke
petercorke changed the base branch from test/mobile-estimator-regressions to main October 13, 2026 23:44
@petercorke petercorke closed this Oct 14, 2026
@petercorke petercorke reopened this Oct 14, 2026
@petercorke
petercorke merged commit 0119d66 into main Oct 14, 2026
22 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (ea7b4d6) to head (d4f81a3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/roboticstoolbox/mobile/EKF.py 0.00% 8 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #749   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        143     143           
  Lines      14271   14274    +3     
=====================================
- Misses     14271   14274    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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