Add RRT online replanning in continuous space (navigation/41)#17
Merged
Conversation
The repo had grid A* online replanning (04) but no sampling-based planner. This adds an RRT (LaValle, 1998) — the continuous-space counterpart — running the same plan/discover/replan loop. The robot plans an RRT with the obstacles it knows and follows the path, but one obstacle is hidden until it comes within sensor range. When a newly sensed obstacle is found to block the remaining path, the world reports a path_blocked failure and the agent replans an RRT from its current position with the updated obstacle set. Plan, discover, replan, arrive. (RRT is randomized, so the first tree occasionally routes around the hidden disc and no replan is needed; the robot reaches the goal either way — the default seed always replans.) - self-contained RRTWorld (known + hidden discs, local sensing, segment-disc collision) + a standalone plan_rrt() and an RRTReplanAgent that detects a blocked path and replans, plus a References section - two smoke tests: the default seed threads the gap, senses the disc, replans, and reaches the goal with no collision; the planner+replanner reach the goal on every seed in range(6) - examples index + navigation README section; example 43->44, tests 120->122 Verified across seeds 0-9 (10/10 reach the goal, ~8/10 trigger a replan; default seed replans once) and the matplotlib render path under Agg. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new example,
examples/navigation/41_rrt_replanning.py: a Rapidly-exploring Random Tree (LaValle, 1998) running the online-replanning loop in continuous space. The repo had grid A* online replanning (04_online_replanning_astar.py) but no sampling-based planner — this adds the continuous-space counterpart.The lesson
RRT plans by growing a tree from the start (sample a point, extend the nearest node a short step toward it, keep collision-free edges) until it reaches the goal. The robot plans with the obstacles it knows and follows the path, but one obstacle is hidden until it comes within sensor range. When a newly sensed obstacle is found to block the remaining path, the world reports
path_blocked, the agent replans an RRT from its current position, and it continues. Plan, discover, replan, arrive.RRT is randomized, so the first tree occasionally routes around the hidden disc and no replan is needed — the robot reaches the goal either way; the default seed always replans.
Contents
RRTWorld(known + hidden discs, local sensing, segment–disc collision), a standaloneplan_rrt()(nearest-node extension, goal bias, reconstruction), and anRRTReplanAgentthat detects a blocked remaining path and replans.range(6).examples/README.mdrow + a fullexamples/navigation/README.mdsection; example count 43→44 and test count 120→122 inREADME.md/docs/status.md.Verification
135 passed); matplotlib render path confirmed underAgg.References
🤖 Generated with Claude Code