Repository navigation
fix(mobile): make PurePursuit usable; rst docstrings and shaped types in drivers.py - #772
Merged
Merged
Conversation
… in drivers.py PurePursuit could not run at all: demand() read self._waypoint_markers that was never assigned, init() crashed with the default linemarkerstyle=None, and __str__ crashed with no workspace. Now: - waypoint markers are created in init() when an axes is given, one per waypoint, with the current goal highlighted in red - linemarkerstyle defaults to a thin dashed line; new waypointmarkerstyle - path is converted to a float 2xN array and validated (ValueError otherwise); note in the code that this belongs in spatialmath getmatrix(), see spatialmath-python#255 - __str__ printed the x range as the y range, for both drivers - argument/return types use spatialmath's Points2, ArrayLike2 and R2 - every docstring is reST (the MATLAB-style demand() docstring and comments are gone), :type: kept only where shape adds information Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…Pursuit Drawing a marker per waypoint is wrong for a dense path from a trajectory generator. Instead the base class owns a single goal marker that driveto() moves each cycle, so RandomPath and PurePursuit share the same code and style. PurePursuit draws its path as one line, linemarkerstyle becomes pathstyle (defaulting to the style used in the book figures). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 13 |
| 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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #772 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 143 143
Lines 14667 14667
=====================================
Misses 14667 14667 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…almarkerstyle Style dict arguments are named <thing>_style. The defaults are the module constants GOAL_STYLE and PATH_STYLE and a user dict is merged over them with the dict union operator, user values winning. goalmarkerstyle still works, with a DeprecationWarning, and is mapped to goal_style. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
5 tasks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 14, 2026
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
PurePursuitinmobile/drivers.pycould not run at all. This PR fixes it, and brings the whole file up to the project's docstring and typing standard.Bugs fixed (problem-list entries 1-3)
PurePursuit.demand()readself._waypoint_marker, which was never assigned:AttributeErroron the first call.PurePursuit.init(ax)crashed with the defaultlinemarkerstyle=None.PurePursuit.__str__crashed when there was no workspace.__str__of both drivers printed the x range as the y range.Design
_init_goal_marker()and moved bydriveto()on every cycle, soRandomPathandPurePursuitshare code and style. It moves; it does not leave a trail.PurePursuitdraws its path as one line, styled by the newpath_styleargument (default: the look used in the book figures).linemarkerstylenever worked, so nothing can depend on it and it is replaced without an alias. No per-waypoint markers, because a path from a trajectory generator is dense.pathis converted to a float 2xN array and validated (ValueErrorotherwise). A comment notes this belongs in spatialmath'sgetmatrix(): getmatrix() rejects a list of lists; revisit the base.X matrix/vector converters rai-opensource/spatialmath-python#255.Naming and deprecation
<thing>_style:goal_style(base class) andpath_style(PurePursuit).goalmarkerstyleis deprecated: it still works, warns withDeprecationWarningand maps togoal_style.GOAL_STYLEandPATH_STYLE; a user dict is merged over them (DEFAULT | user, the user's values win).mobileis a separate change.Typing and docstrings
Points2,ArrayLike2andR2, since the names tell the reader what the shape is.:type:is kept only where shape adds information.Testing
DriversTest(path validation,__str__, a run without animation, the moving goal marker, theRandomPathgoal marker). Four of them fail onmainand pass here; theRandomPathmarker test passes on both and guards the refactor.🤖 Generated with Claude Code