Robot Path Planning: RRT and PRM Algorithms Visualized

simulator advanced ~12 min
Loading simulation...
RRT: path found in ~350 iterations

RRT rapidly explores the space by growing a tree of random samples. With 10 obstacles and step size 20, a path is typically found in 300-500 iterations. The path is collision-free but not necessarily shortest.

Formula

x_new = x_nearest + step_size × (x_rand - x_nearest) / |x_rand - x_nearest|
PRM edge cost = Euclidean distance between connected nodes
RRT* rewire condition: cost(x_near via x_new) < cost(x_near via parent)

Finding a Way Through Obstacles

Path planning is a core challenge in robotics: find a collision-free path from start to goal in an environment with obstacles. While simple in a 2D maze, the problem becomes extraordinarily hard for robot arms with 6+ degrees of freedom, where the 'space' is high-dimensional and obstacles create complex forbidden regions. Sampling-based algorithms like RRT and PRM solve this efficiently by exploring the space randomly rather than exhaustively.

Rapidly-Exploring Random Trees (RRT)

RRT grows a tree rooted at the start configuration. Each iteration samples a random point in space, finds the nearest node in the tree, and extends toward the sample by a fixed step size. If the extension is collision-free, the new node is added. The tree has a natural bias toward unexplored regions because random samples in large empty areas are more likely to be nearest to frontier nodes. This Voronoi bias is the key insight that makes RRT effective.

Probabilistic Roadmaps (PRM)

PRM takes a different approach: first build a roadmap of the free space, then query it. The construction phase samples many random collision-free configurations and connects nearby pairs with collision-free straight-line paths. The result is a graph that approximates the connectivity of free space. Any start-goal query is answered by connecting both to the nearest roadmap nodes and running a graph search algorithm like Dijkstra's or A*.

From 2D to Configuration Space

This simulation shows path planning in 2D for visual clarity, but the same algorithms work in any dimension. For a 6-DOF robot arm, each axis represents a joint angle, and obstacles in physical space map to complex forbidden regions in this 6D configuration space. RRT and PRM handle this gracefully because they only need collision checking (not explicit obstacle representation) and scale well with dimensionality.

FAQ

What is RRT (Rapidly-exploring Random Tree)?

RRT is a sampling-based path planning algorithm. It grows a tree from the start configuration by repeatedly: (1) sampling a random point, (2) finding the nearest tree node, (3) extending toward the sample by a step size, (4) checking for collision. The tree rapidly explores the space and eventually reaches the goal.

What is PRM (Probabilistic Roadmap)?

PRM builds a graph (roadmap) by sampling random collision-free configurations and connecting nearby ones with collision-free edges. Once built, any start-goal query is answered by connecting both to the roadmap and searching with A* or Dijkstra. PRM is efficient for multiple queries in a static environment.

Why not just use A* for path planning?

A* works on a discretized grid, which is feasible in 2D but becomes computationally intractable in high-dimensional configuration spaces (e.g., 6-DOF robot arms). Sampling-based methods like RRT and PRM work directly in continuous space and scale much better to high dimensions.

What is RRT* and how does it improve on RRT?

RRT* adds rewiring: after adding a new node, it checks if nearby nodes would have shorter paths through the new node, and rewires the tree accordingly. Given enough iterations, RRT* converges to the optimal path. Standard RRT finds any feasible path quickly but without optimality guarantees.

Sources

Embed

<iframe src="https://homo-deus.com/lab/robotics/path-planning/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub