Sampling-Based Planners for High Dimensions
Grid search feels almost unstoppable in 2D — until you try running A* on a 7-joint robot arm. The first time I computed how much RAM a naive 7D grid takes, I thought I had misplaced a decimal point.
Core ideas covered in this module
- Curse of dimensionality
- Probabilistic Roadmaps (PRM)
- RRT & asymptotically optimal RRT*
The grid explosion in 6 and 7 dimensions
Suppose you discretize each joint of a robot arm into just 50 bins — roughly 7 degrees per step, which isn't even very fine. For a 2-link arm, 50 × 50 is 2,500 cells. Easy.
Now try a standard 6-DOF industrial arm: 50⁶ is 15.6 billion cells. On a 7-DOF arm like a Franka Panda, 50⁷ is 781 billion cells. You cannot store that grid in memory, let alone run A* over it before the battery dies. That exponential blowup is the curse of dimensionality.
Throwing random darts instead of painting every square
Instead of visiting every grid cell in order, sampling-based planners toss random configurations into C-space and check whether they are collision-free. Two families dominate real robotics libraries:
- Probabilistic Roadmaps (PRM): scatter random valid points across the whole space, connect nearby points with collision-free straight lines to build a reusable highway network, then run graph search on that sparse roadmap.
- Rapidly-Exploring Random Trees (RRT): grow a single branching tree outward from the start pose. Each step picks a random target point in space, finds the nearest existing tree node, and extends one small step toward it — naturally pulling branches into unexplored rooms.
- RRT*: keeps the fast exploration of RRT, then rewires nearby branches whenever a new sample offers a shorter route back to the start, gradually straightening jagged random paths toward optimal ones.
Interactive lab
BFS, Dijkstra, A*, and RRT Pathfinding Visualizer
Canvas / SVG· LiveProbabilistic completeness and the narrow-passage headache
Because RRT never builds a uniform grid, it works just as easily in 7 or 14 dimensions as it does in 2D. If a valid path exists, the odds of finding one approach 100% as you add more samples — a property called probabilistic completeness.
The catch is narrow doorways. Random darts mostly land in big open rooms, so threading through a keyhole takes patience (or goal-biasing and bidirectional RRT-Connect, which grows two trees toward each other from both start and goal at once). And raw RRT paths look jittery and circuitous, which is why we always smooth them afterward.
Why grids fail while trees scale
Grid cells = N^d vs. RRT step: q_new = q_near + ε · (q_rand − q_near) / ‖q_rand − q_near‖
Grid size grows exponentially with dimension d, making N^d hopeless past 3–4 DOF. RRT only stores sampled vertices and straight local segments, scaling to 7+ DOF arms and multi-robot teams.
Why does standard RRT almost always produce a jagged, longer-than-necessary path on its first solution, whereas RRT* improves it over time?
Bidirectional RRT-Connect (inside OMPL and MoveIt) is still one of the most common default arm planners in factories and research labs, often paired with trajectory optimization or GPU-parallelized rollouts like cuRobo.
Hands-On Python Notebook
03 · Sampling-Based Planners: PRM, RRT & RRT*
Grow an RRT and rewiring RRT* tree through narrow passages and compare path length improvement over iterations.
Try this on your own inside the notebook
- Vary the goal-bias probability and step size through a narrow corridor
- Add shortcut path pruning to smooth a raw RRT solution
In Google Colab, use File → Save a copy in Drive to keep your own edits and notes. Or download the files directly:
uvx marimo edit --sandbox notebooks/course-3/03_sampling_based_planners_rrt.pyWrap up this module
Saved automatically in your browser profile so you can pick up right where you left off.