RRT* Algorithm (Rapidly-exploring Random Tree Star)
RRT* is a sampling-based path planning algorithm that keeps the exploration behavior of RRT, but continuously improves path quality by optimizing local tree connections.
Review RRT First
If you want a quick refresher before continuing, review the RRT module here:
Quick Review: Core RRT Idea
RRT builds a tree by repeating these steps:
- Randomly sample a point in free space.
- Find the nearest existing tree node.
- Steer from that node toward the sample by a fixed step.
- Add the new node if the edge is collision-free.
This process is very good at rapidly exploring complicated spaces and finding a feasible path.
Why Move From RRT to RRT*?
RRT is great at quickly finding a feasible path in complex spaces, but it does not explicitly optimize path cost.
In basic RRT, each new node is typically attached to the nearest node, which can lock in a poor local choice early.
As a result, RRT often returns a valid route that is:
- Longer than needed.
- Not smooth.
- Not close to minimum cost.
RRT* addresses this limitation with local cost optimization using rewiring:
- Choose a better parent for the new node (not just nearest).
- Re-check nearby nodes and reconnect them if the new node gives a lower-cost path.
In practice:
- RRT: finds a path quickly.
- RRT*: keeps improving that path as more samples are added.
RRT* is asymptotically optimal, meaning that with enough samples, the solution converges toward the optimal path.
The Core Difference: Rewire
When a new node \(x_{new}\) is added to our tree, RRT* additionally performs two checks in a local neighborhood.
Step 1: Find the Best Parent for the New Node
For a sampled node \(x_{new}\), consider nearby nodes \(x_i\) in a radius \(r_n\).
Among collision-free candidates, select the parent that minimizes:
where \(J(x_i)\) is the current cost-to-come from start to node \(x_i\).
This is different from basic RRT, which always connects \(x_{new}\) to the nearest node only.
Step 2: Rewire Nearby Nodes Through the New Node
After choosing the parent of \(x_{new}\), check each nearby node \(x_{near}\) within radius \(r_n\).
If routing through \(x_{new}\) is cheaper, then change its parent:
If true (and collision-free), rewire \(x_{near}\) to \(x_{new}\).
This is the key reason RRT* improves path quality over time.
Cost Function and Radius (Used by Rewire)
Rewiring decisions depend on two things:
- A path cost function to compare alternatives.
- A near-node radius to decide which nodes are candidates for parent selection and rewiring.
Defining the Cost Function in RRT*
In RRT, each node stores a *cost-to-come** from the start:
Here, \(c(a,b)\) is the edge cost from node \(a\) to node \(b\).
The total path cost is the sum of all edge costs along the branch.
How to Choose the Near-Node Update Radius
RRT* uses a neighborhood radius when selecting parent and rewiring.
A common theoretical form is:
where:
- \(n\): number of nodes currently in the tree.
- \(d\): planning space dimension.
- \(\gamma\): scaling constant (controls neighbor count).
- \(\eta\): upper bound radius (often tied to steering step size).
Why this helps:
- Early in planning (small \(n\)), \(r_n\) is larger, so the algorithm explores broadly.
- Later (large \(n\)), \(r_n\) shrinks, so rewiring becomes more local and refined.
Pseudocode (RRT* Loop)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Rewire Intuition Example
Assume node 9 is newly added and the yellow circle is its neighborhood.
In this example, RRT* first computes the best parent for node 9, then checks if 4, 5, or 8 become cheaper when connected through 9.
Quick Check Quiz 1 (Best Parent Selection)
Use the same figure above. Assume all dashed candidate edges are collision-free and edge labels are edge costs.
Through 6: \(0 \rightarrow 2 \rightarrow 6 \rightarrow 9 = 3 + 5 + 3 = 11\)
Through 8: \(0 \rightarrow 2 \rightarrow 6 \rightarrow 8 \rightarrow 9 = 3 + 5 + 1 + 3 = 12\)
Through 5: \(0 \rightarrow 5 \rightarrow 9 = 19 + 4 = 23\)
Through 4: \(0 \rightarrow 5 \rightarrow 4 \rightarrow 9 = 19 + 5 + 1 = 25\)
Minimum cost is through node 6.
Quick Check Quiz 2 (Rewire Decision)
After selecting node 6 as parent of node 9, which neighbors should be rewired to 9?
Node 4 current: \(24\). Through 9: \(11 + 1 = 12\) -> improve, so rewire.
Node 5 current: \(19\). Through 9: \(11 + 4 = 15\) -> improve, so rewire.
Node 8 current: \(9\). Through 9: \(11 + 3 = 14\) -> no improvement, keep current parent.
So only nodes 4 and 5 are rewired.