Skip to content

fix(mobile): VehicleBase control handling and plot_xyt, tests and docstrings - #774

Merged
petercorke merged 3 commits into
mainfrom
bug/mobile-vehicle
Oct 15, 2026
Merged

petercorke merged 3 commits into
mainfrom
bug/mobile-vehicle

Conversation

@petercorke

@petercorke petercorke commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

What

Fixes in VehicleBase (mobile/Vehicle.py) found during the typing pass, with tests and a docstring pass. Trailer classes (Trailer, DiffSteerTrailer, VehicleTrailer) are out of scope, see #773.

Bugs fixed

  • A constant tuple as control= in the constructor raised AttributeError, and every driver passed that way emitted an "add_driver is deprecated" warning. The constructor now uses the control setter. (A function as control= already worked.)
  • init(control=...) and so run(control=driver) assigned _control directly and never connected the driver to the vehicle, so demand() failed. Same one-line fix.
  • plot_xyt plotted x, y and theta against the x coordinate, not time (t was computed and never used). It now plots against time with an axis label.
  • plot_xy: removed an unreachable "default color" branch (args is a tuple, never None). Behaviour is unchanged.

Removed

The plot and trailers arguments of VehicleBase.__init__ were never read. Nothing in RTB, or in the RVC3 notebooks and figure scripts, passes them to a vehicle. VehicleTrailer keeps its own trailers argument. Anyone passing them now gets a TypeError.

Docstrings

Placeholder type, broken class reference, :note: that was not a valid field, missing :raises: for polygon() and run_animation(), a nonexistent :param args:, and leftover MATLAB comments.

Testing

Nine new tests in TestVehicleBase. Six fail on main and pass here; the other three cover error paths that were already safe (polygon(), eval_control() and run_animation() raising ValueError). mypy is clean.

Related: #772 (drivers). The two PRs both add test classes to tests/test_mobile.py, so whichever merges second may need a trivial rebase.

🤖 Generated with Claude Code

…strings

- constructor control= used the deprecated add_driver for every control, so a
  constant tuple raised AttributeError and every driver emitted a deprecation
  warning; now uses the control setter
- init(control=...) and run(control=driver) assigned _control directly and never
  connected the driver to the vehicle; now uses the control setter
- plot_xyt plotted x, y and theta against x, not time (t was computed and unused)
- plot_xy had an unreachable default-color branch (args is a tuple); removed,
  behaviour is unchanged
- docstring fixes: placeholder type, broken class reference, :note: field,
  :raises: for polygon() and run_animation(), MATLAB comments
- tests for the above, and for the ValueError paths of polygon(),
  eval_control() and run_animation()

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 1 complexity · 0 duplication

Metric Results
Complexity 1
Duplication 0

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.

…hicleBase

Neither was read, and nothing in RTB or the RVC3 notebooks and figure scripts
passes them to a vehicle.  VehicleTrailer keeps its own trailers argument.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
src/roboticstoolbox/mobile/Vehicle.py 0.00% 7 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #774   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        143     143           
  Lines      14667   14663    -4     
=====================================
+ Misses     14667   14663    -4     

☔ 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.

@petercorke
petercorke merged commit 2ee9fa9 into main Oct 15, 2026
23 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 15, 2026
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