Skip to content

fix(mobile): reject PRM maps with no free cells - #931

Open
Afloat16 wants to merge 1 commit into
petercorke:mainfrom
Afloat16:fix/prm-fully-occupied-grid
Open

Afloat16 wants to merge 1 commit into
petercorke:mainfrom
Afloat16:fix/prm-fully-occupied-grid

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Problem

PRM roadmap construction rejection-samples coordinates until it finds an unoccupied point. When the occupancy grid has no free cells, that loop never terminates. This can also occur after obstacle inflation removes the last free cell.

Change

Before sampling a nonempty roadmap, check whether the effective occupancy grid contains any free cells and raise NoPathError if it does not. Document the error on plan. Empty roadmap requests retain their existing behaviour.

The regression covers both an initially full grid and a grid made full by inflation, plus a free-space control that builds a real roadmap. The impossible cases use the project's timeout plugin to detect the former infinite loop.

Validation

  • Original source: both impossible-map cases time out after 2 seconds; the free-space control passes.
  • PYTHONPATH=src python -m pytest tests/test_prm_free_space.py tests/test_mobile_planners_a.py tests/test_mobile_performance.py -k 'PRM or prm or free_cells' -q: 14 passed, 22 deselected.
  • Ruff passes for the changed source and new test file; the new file passes formatting.
  • git diff --check passed.

@Afloat16
Afloat16 marked this pull request as ready for review November 3, 2026 13:56
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
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.

This branch has not been deployed

No deployments
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