AtsushiSakai/PythonRobotics

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

Closed this issue · 0 comments

Describe the bug
In the current implementation of path_smoothing(), the line_collision_check() used during smoothing does not correctly account for the robot’s radius. This can result in smoothed paths that pass dangerously close to obstacles, even if the original RRT path maintains a safe margin.

Expected behavior
Smoothed paths should respect the robot_radius and maintain the same clearance from obstacles as the original RRT path.

Screenshots
Here I set robot_radius=0.5.

    rrt = RRT(start=[0, 0], goal=[6, 10],
              rand_area=[-2, 15], obstacle_list=obstacleList, robot_radius=0.5)
    path = rrt.planning(animation=show_animation)

Image

Desktop (please complete the following information):

  • Python version: Python 3.13.4

  • OS version: Windows 10.0.19045

  • Each library version:

Package Version
numpy 2.2.4
scipy 1.15.2
matplotlib 3.10.1
cvxpy 1.6.5
ecos 2.0.14
pytest 8.4.0
pytest-xdist 3.7.0
mypy 1.16.0
ruff 0.11.12

How to Reproduce

  1. Run the default main() function from the RRT demo.
  2. Use obstacles close to the planned path, and set a non-zero robot_radius (e.g., robot_radius=0.5).
  3. Observe that:
    • The original RRT path respects the robot radius and avoids collisions.
    • The smoothed path may cut corners too closely, passing within robot_radius of obstacles.