Repository navigation
fix(mobile): type ParticleFilter, and fix x0, gif and mp4 output - #883
Merged
Merged
Conversation
…ound ParticleFilter is checked by mypy and under disallow_untyped_defs, so it leaves the list of modules still to do. The history is now a PFlog NamedTuple, with the same field names. Bugs that were hidden because the module was ignored: - run_animation(format="gif" or "mp4") used self.dt, which does not exist, so both raised AttributeError. It uses robot.dt, and the frame rate is an integer as the writers require. A gif or mp4 without a file name is a ValueError. - the map property returned self._map, which was never set, and verbose returned self._verbose, which was never set (and the argument was ignored). map is the map of the sensor, and verbose is what was given. - no workspace is a ValueError saying so, not a TypeError from indexing None. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
_init handled x0=None (the constructor's x0, else random over the workspace) but did nothing when x0 was given, so the particles were never set. A vector (x, y, theta) now puts every particle there and a matrix with a row per particle gives each its own state; the array is copied, since the particles are updated in place. Any other shape is a ValueError. The constructor docstring is raw, as its \theta was a tab. An mp4 test runs when ffmpeg is available. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…to run_animation The constructor documents the three cases (None, a state for every particle, a row for each particle) in a table, that identical particles are spread by the noise R, and that the array is copied. run and run_animation refer to it, and _init's comment is current. run_animation took x0 but never passed it on, so it started from the constructor's value whatever it was given. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
petercorke
enabled auto-merge (squash)
October 22, 2026 05:06
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 2 high |
| Security | 15 high |
🟢 Metrics 27 complexity · 0 duplication
Metric Results Complexity 27 Duplication 0
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.
Merged
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #883 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 146 146
Lines 17212 17241 +29
=====================================
- Misses 17212 17241 +29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What
ParticleFilterwas the last module inmobile/that mypy ignored. This annotates it, so it is checked and held todisallow_untyped_defswith the other modules, and fixes the bugs that the types showed.It carries the three commits of #735 (circular particle heading moments) from @Afloat16, with their authorship, so this supersedes #735. The typing could not be done in the same file while that PR was open.
Bugs fixed (public behavior changes)
run_animation(format="gif")and"mp4"raisedAttributeError(self.dtdoes not exist). They userobot.dtand an integer frame rate, and a missing file name is aValueError.x0was ignored when given:_initset the particles only forx0=None. A state(x, y, theta)now puts every particle there, and a matrix with a row per particle gives each its own. It is copied, and any other shape is aValueError.run_animationdid not passx0on at all.mapproperty readself._mapandverbosereadself._verbose, neither of which was ever set, and theverboseargument was ignored.ValueErrorthat says so, not aTypeErrorfrom indexingNone.The history is now a
PFlogNamedTuplewith the same field names. Numerical results of the filter are unchanged by this PR beyond #735's heading moments.Checked
ParticleFilterremoved from the list of modules still to do.tests/test_particle_filter_api.py(gif and mp4 written,x0in all its forms and copy semantics,map,verbose, the errors), and fix(mobile): use circular particle heading moments #735's tests.tests/test_servo_half_turn.pywas left out because it fails with a compiled extension built before fix(ik): preserve arbitrary half-turn pose error magnitude #793, which is a local build matter.Co-authored-by: Afloat 132809511+Afloat16@users.noreply.github.com
🤖 Generated with Claude Code