Skip to content

Fix PRM collision checks to account for the full edge - #1482

Open
huxiaoyi-ovo wants to merge 4 commits into
AtsushiSakai:masterfrom
huxiaoyi-ovo:fix/prm-continuous-edge-collision
Open

huxiaoyi-ovo wants to merge 4 commits into
AtsushiSakai:masterfrom
huxiaoyi-ovo:fix/prm-continuous-edge-collision

Conversation

@huxiaoyi-ovo

Copy link
Copy Markdown

Summary

The PRM planner currently checks collision only at points spaced by the robot radius. It can therefore accept an edge that intersects an obstacle's clearance disk.

For example, an edge from (0, 0) to (1, 0), with robot radius 1.0 and an obstacle at (0.5, 0.95), has a true clearance of 0.95. The current code checks only the endpoints, both about 1.074 away, and incorrectly returns False (no collision).

The same function divides by the robot radius, causing a ZeroDivisionError for a point robot (rr=0).

Fix

  • Use the KDTree to shortlist obstacles within the swept edge's bounding ball.
  • Compute the exact minimum distance from each candidate obstacle to the line segment, with the projection clamped to its endpoints.
  • Handle zero-length edges and zero-radius robots without special sampling assumptions.
  • Preserve the existing MAX_EDGE_LEN constraint and is_collision API.

Validation

The added regression tests cover a collision missed between discrete samples, noncolliding clearance, a point robot with obstacles on/off the edge, a zero-length segment, and obstacles beyond the endpoint. Eight direct geometry checks passed, including an empty-obstacle KDTree.

Full Linux, macOS, Windows, and CodeQL validation is running in fork CI PR #5.

Changes: two files; no new dependencies.

AI disclosure: ChatGPT assisted with code analysis, implementation, and test preparation.

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