FixTheRobot Explore Robotics / Navigation / M4 / M4-L3

This lab works on phones, but writing code is much easier on a laptop.

Navigation · Sampling-Based and Kinodynamic Planning · M4-L3 · Advanced

Rewire to a Better Path with RRT*

17:10. The RRT route across the dock is 60 percent longer than it needs to be, and the pallets arrive late. Facilities do not care that the route is valid; they want it short, and they are willing to spend more computing time on it.

You will give the tree two new habits: hang each new node from the cheapest neighbour, and let the new node shorten the routes of its neighbours. Then you will watch the cost fall against the number of samples.

Your task

    Simulation
    solution.pyLoading Python…
    Ctrl+Enter runs
    What Python can I use?

    Plain Python with math and heapq. Your code runs in a background worker: an endless loop is stopped after a few seconds and the page stays usable. It runs in your browser and is never sent anywhere.

    Hints

    What this lab teaches

    Stage 1 is the choice of parent by cost-to-come plus edge length. Stage 2 is the rewiring step, which compares total costs, recomputes them from the current parents, and never creates a loop. Stage 3 puts both into the full RRT* loop, where the neighbourhood radius is a different quantity from the step size. Stage 4 plots the best path against the samples for RRT and RRT*, and asks about Informed RRT*.

    Grading is result-based: trees are checked for validity, collision-freedom and the length of the path compared with the shortest route.

    Theory for this lab

    Sampling-Based and Kinodynamic Planning labs

    1. M4-L1: Collision-Check a Footprint
    2. M4-L2: Grow an RRT
    3. M4-L3: Rewire to a Better Path with RRT*: this lab.
    4. M4-L4: Park the Car-Like Robot

    Educational simplification: the same dock as the RRT lab, a fixed neighbourhood radius where the theory shrinks it with the number of nodes, straight-line edges, and a path length measured along the tree to the goal point.

    Get the next lab

    Get notified when new robotics labs are released. One email per new lab, nothing else.