Skip to content

Fix/path smoothing robot radius #1231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ShiboWork
Copy link

Reference issue

What does this implement/fix?

This PR fixes an issue in the path_smoothing() function, where the collision checking via line_collision_check() did not take robot_radius into account correctly. This caused the smoothed path to pass dangerously close to obstacles.

  • Modified line_collision_check() to check collision along finite-length line segments and incorporate robot_radius.
  • Updated path_smoothing() logic to use this corrected check.
  • Added a new unit test to verify that smoothed paths maintain clearance from obstacles based on robot radius.

Additional information

  • Confirmed original vs smoothed paths via animation and test assertions.

CheckList

  • Did you add an unittest for your new example or defect fix?
  • Did you add documents for your new example? N/A (not a new algorithm)
  • All CIs are green? (You can check it after submitting)

@AtsushiSakai AtsushiSakai requested a review from Copilot June 15, 2025 13:12
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures the path smoothing routine respects the robot’s radius by updating collision checks and adding a safety-focused unit test.

  • Expanded line_collision_check to sample finite-length segments and inflate obstacles by robot_radius.
  • Updated path_smoothing to pass robot_radius into collision checks.
  • Added a new test verifying no smoothed path point encroaches on obstacles.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/test_rrt_with_pathsmoothing_radius.py New test ensuring smoothed path maintains clearance.
PathPlanning/RRT/rrt_with_pathsmoothing.py Modified collision logic and updated function calls.
Comments suppressed due to low confidence (2)

tests/test_rrt_with_pathsmoothing_radius.py:43

  • [nitpick] Using a strict '>' may fail when a point lies exactly at the clearance boundary. Consider using '>=' if touching the safety radius is acceptable or adjust the test to account for floating-point tolerances.
assert d > min_safe_dist, \

PathPlanning/RRT/rrt_with_pathsmoothing.py:76

  • [nitpick] The variable 'size' represents an obstacle radius. Rename it to 'obs_radius' or 'radius' for clearer semantics.
for (ox, oy, size) in obstacle_list:

Copy link
Owner

@AtsushiSakai AtsushiSakai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for great PR!!. I have some small comments. PTAL.

@ShiboWork ShiboWork force-pushed the fix/path_smoothing_robot_radius branch from df9cdad to f57fb4f Compare June 20, 2025 02:02
@ShiboWork ShiboWork requested a review from AtsushiSakai June 20, 2025 02:22
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.

Bug: path_smoothing() Ignores robot_radius, Causing Smoothed Paths to Violate Obstacle Clearance
2 participants