Skip to content

fix(mobile): maps: stricter arguments, clearer names, docstrings and types - #779

Merged
petercorke merged 2 commits into
mainfrom
bug/mobile-maps
Oct 15, 2026
Merged

petercorke merged 2 commits into
mainfrom
bug/mobile-maps

Conversation

@petercorke

Copy link
Copy Markdown
Owner

What

The map classes (OccGrid.py, landmarkmap.py): entries 15-17 of the typing-pass problem list and what a review of the two files turned up. Builds on the workspace resolver (#776).

Fixed

  • BaseMap and the occupancy grids swallowed unknown keyword arguments, so BinaryOccupancyGrid(g, size=0.1) was accepted and ignored (the argument is cellsize). It is now a TypeError.
  • A grid with neither an array nor a workspace failed later with AttributeError; it is a ValueError at construction (entry 16).
  • PolygonMap.iscollision is documented to accept an ndarray but crashed on one; it now wraps it in a Polygon2.
  • LandmarkMap.plot dropped its whole default style as soon as any keyword was given; options are now merged over LANDMARK_STYLE.
  • A NumPy integer was rejected as a landmark count.
  • set() documented the region as [xmin, ymin, xmax, ymax]; the code (and now the docstring) use [xmin, xmax, ymin, ymax], as for a workspace.

Renamed (old names still work)

  • dx, dy are replaced by width, height properties.
  • w2g, g2w, line_w become world_to_grid, grid_to_world, line_world; the short names are kept as plain aliases (used in PoseGraph.py).
  • LandmarkMap(map=...) becomes LandmarkMap(landmarks=...); map= is a deprecated keyword. The first positional argument is unchanged.
  • LandmarkMap(verbose=...) had no effect and is deprecated.

Not touched: negative-index wrap in BinaryOccupancyGrid.isoccupied, which contributor PR #769 fixes.

Docstrings and types

ArrayLike2, ArrayLike4, R2, R4, Points2; typos; missing docstrings added (PolygonMap.plot, the __str__ and __repr__ methods); stale __main__ demos and lgtm comments removed.

Full suite 1077 passed (with both compiled extensions), mypy clean.

🤖 Generated with Claude Code

… and types

OccGrid.py
- BaseMap and the grids no longer swallow unknown keyword arguments, so
  BinaryOccupancyGrid(g, size=0.1) is a TypeError (the argument is cellsize)
- a grid with neither an array nor a workspace is a ValueError, not an
  AttributeError later
- dx/dy become width/height properties; w2g/g2w/line_w become
  world_to_grid/grid_to_world/line_world, the short names kept as aliases
- PolygonMap.iscollision accepts the ndarray its docstring said it did
- set() documents the region order it actually uses, [xmin, xmax, ymin, ymax]
- types ArrayLike2/ArrayLike4/R2/R4; typos; stale __main__ demo and lgtm
  comments removed; missing docstrings

landmarkmap.py
- plot() merges any options over LANDMARK_STYLE; any keyword used to drop the
  whole default style
- an integer count may be a NumPy integer
- first argument is landmarks (map deprecated), verbose deprecated (no effect)
- MATLAB-style comment replaced by a docstring; reference updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 high

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
ErrorProne 2 high

View in Codacy

🟢 Metrics 17 complexity · 2 duplication

Metric Results
Complexity 17
Duplication 2

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.

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
src/roboticstoolbox/mobile/OccGrid.py 0.00% 38 Missing ⚠️
src/roboticstoolbox/mobile/landmarkmap.py 0.00% 22 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #779   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        144     144           
  Lines      14712   14729   +17     
=====================================
- Misses     14712   14729   +17     

☔ 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 ec1e3fe into main Oct 15, 2026
22 of 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