Repository navigation
fix(mobile): Bug2 animation, trapped, border handling, and docstrings - #780
Merged
Merged
Conversation
Defects (each with a test that failed first): - run(animate=True) raised on current Matplotlib: set_data was given the 1-D start point on the first frame - run() without animation drew a marker at the origin on the current axes (and could create a figure); the trail artists are now made only if animating - the movie argument implied animate but no movie was written; it now uses MovieWriter - run(**kwargs) swallowed unknown arguments (fig5_5.py passes label='path', which is now a real argument naming the trail in the legend) - next() called plt.show(block=True) before raising 'robot is trapped' - start == goal gave a division by zero (hom_line) and a RuntimeWarning - plot_m_line ignored its style for a vertical m-line; it now forwards *args, **kwargs to plot like the other single-line plots - edgelist/adjacent_point wrapped around at the left and top borders and raised at the right and bottom; the area outside the image is now outside the blob, which leaves every book path unchanged - bare except clauses removed; unused h, d, l, y; dir shadowed the builtin Docstrings and types: ndarray(N,2) path, R3 m-line, ArrayLike2, corrected direction names, the authors' names, hom_line documented. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
5 tasks
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 1 high |
| Security | 1 high |
🟢 Metrics 42 complexity · 0 duplication
Metric Results Complexity 42 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.
The robot has crossed the m-line when it is within half a cell of it, but a line at 45 degrees to the grid passes between two diagonal neighbours at sqrt(2)/2 from each, so it could be stepped over and the robot was reported as trapped. The tolerance is sqrt(2)/2 (plus rounding). The only published path that changes is the house floorplan bedroom to kitchen example, 1306 points instead of 1307 (versionchanged 1.4.5 in the docstring, a test pins it). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #780 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 144 144
Lines 14729 14733 +4
=====================================
- Misses 14729 14733 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 of 4 tasks
petercorke
added a commit
that referenced
this pull request
Oct 15, 2026
…Bug2 and PRM fixes (#782) * test(mobile): planner base contract tests (WIP, failing until the implementation commit) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * refactor(mobile): PlannerBase declares no verbs; validate_start_goal; stepping loop moves to DistanceTransformPlanner PlannerBase is no longer an ABC and has no plan/next/query. Planners define the verbs that make sense for them. validate_start_goal replaces the base query's validation. Bug2 no longer inherits plan/query that raise. DistanceTransformPlanner.query owns the stepping loop; next=/movie= are deprecated no-ops. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * refactor(mobile): RRT and Dstar validate start through validate_start_goal; QuinticPoly and CurvaturePoly already do Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * feat(mobile): NoPathError for a valid problem with no solution Raised by DistanceTransform, PRM, Lattice, QuinticPoly and Bug2 (trapped). It is a RuntimeError subclass, so existing handlers continue to work. Query before plan is a single RuntimeError text across planners. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * feat(mobile): animation helper on PlannerBase; animate and movie at the constructor animation_start/frame/end own pacing and the movie file, the planner draws. DistanceTransform, Bug2, RRT and Dstar use it, with a per-call override. DistanceTransform.query movie is now implemented. Dstar.plan animate/progress are deprecated no-ops, and Dstar.query no longer prints. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(mobile): shaped argument types and trimmed redundant :type: lines in RRT, Lattice, Dstar, Dubins, ReedsShepp Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(mobile): planner families, failure and animation in the planning docs and PlannerBase Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * feat(mobile): PRMPlanner collision_step, the spacing in cells of the edge collision test Default None keeps the existing approximate test. OccGrid gains cellsize. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(mobile): PRMPlanner collision_step, smaller values give no gain Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(mobile): Bug2 raises NoPathError instead of looping when the goal is enclosed Meeting the same hit point twice means no progress. The house path is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(mobile): Bug2 leaves an obstacle only where the next m-line step is free Removes the repeated cells from a leave that is blocked at once, and ends the run for a goal enclosed by an obstacle. House bedroom to kitchen is 1304 points (1307 published, 1306 with the tolerance change in #780). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(mobile): Bug2 does not repeat the cell where an obstacle is first hit House bedroom to kitchen is 1302 points (1307 published). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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
Bug2.py(entries 23-25 of the typing-pass problem list,h = None, and what a review of the file turned up).Bugs fixed (each test failed first)
run(animate=True)raised on current Matplotlib:set_datawas given the 1-D start point on the first frame.run()without animation drew a marker at the grid origin on the current axes (and could create a figure). The artists are now made only when animating.next()calledplt.show(block=True)before raising "robot is trapped", which blocks a script (entry 25).movieargument impliedanimatebut no movie was written; it now usesMovieWriter.run(**kwargs)swallowed unknown arguments.fig5_5.pypasseslabel='path';labelis now a real argument that names the trail in the legend (default "robot path"), and anything else is aTypeError.start == goalgave a division by zero inhom_lineand aRuntimeWarning.plot_m_lineignored its style for a vertical m-line. It now forwards*args, **kwargstoplot, soplot_m_line("r-")andplot_m_line(color="g")both work.edgelist/adjacent_pointwrapped around at the left and top borders and raised at the right and bottom. The area outside the image is now outside the blob. The paths for the house floorplan (both directions) andmap1are identical before and after.except:clauses (entry 24), the unusedh,d,l,y, anddirshadowing the builtin are removed.Docstrings and types
Path is
ndarray(N,2)(it said(2,N)),m_lineisR3, the direction names were wrong (NWtwice), a mangled author list,:type current:fortrail, andhom_linewas undocumented.Behaviour change: a diagonal crossing of the m-line is now seen
Bug2 reported "robot is trapped" when the m-line passed exactly through block corners at 45 degrees. The crossing test was
abs(inner) <= 0.5cells, but a line at 45 degrees to the grid passes between two diagonal neighbours at 0.707 from each, so the robot could step over it without ever being within half a cell. The tolerance is nowsqrt(2)/2(plus1e-9for rounding, since a diagonal neighbour is exactly that far away).Effect on existing paths, measured: of the book cases (house floorplan both ways,
map1) and three block cases, only one path changes: the house floorplan, bedroom to kitchen (Fig 5.5), from 1307 points to 1306.kitchen -> br3(3985),map1(334) and the straight and shallow block paths are identical.The published number 1307 therefore needs an erratum. The change is documented in the
rundocstring (.. versionchanged:: 1.4.5) and a test pins the new length.Notes for the book scripts (petercorke/RVC3-python#55)
fig5_5.pypasseslabel='path', which now takes effect (legend text "path" instead of "robot path").Full suite 1065 passed (with both compiled extensions), mypy clean.
🤖 Generated with Claude Code