Repository navigation
Add BIT* planner optimising a pluggable cost function - #1
Merged
Merged
Conversation
`cmake.minimum-version` was removed in scikit-build-core 0.8, so `pip install -e .` failed outright with "Use cmake.version instead of cmake.minimum-version". Switch to `cmake.version` and require a backend version that understands it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
BIT* (Batch Informed Trees), following Gammell et al. 2015 and the classic two-queue ompl::geometric::BITstar (OMPL 1.4.2; OMPL's current BITstar is really Advanced BIT*, which drops the vertex queue). Unlike RRT-Connect it returns the cheapest path it found rather than the first feasible one. The cost model lives in its own header so it can be filled in independently. CostFunction::state_cost is the single stub: it takes one Config and reads the (x, y, theta) context vector fixed at planner setup. It returns 0 today, which reduces BIT* to weighted-SE(2) shortest path, so the planner is runnable and testable before the real cost exists. A path is charged the line integral of the density `1 + state_cost`, so an edge costs the distance it covers plus whatever the cost adds along it. Keeping the length term is what makes CostFunction::heuristic_cost (plain distance) an admissible lower bound, keeps every edge cost positive so rewiring cannot cycle, and keeps the optimum well defined where the cost is zero. A cost that breaks the non-negative contract is clamped in edge_cost rather than left to corrupt the search: a negative state_cost would otherwise let a vertex be reparented under its own descendant and spin update_descendants() forever. Exposed to Python additively as Planner.plan_bit_star() plus a cost_context kwarg; the existing plan() is unchanged. Renames the RRT-Connect demo to run_rrtc_planner.py and adds run_bit_star.py, which sweeps the batch budget to show the cost falling. 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
Adds BIT* (Batch Informed Trees) as a separate planner, following Gammell et al. 2015 and the classic two-queue
ompl::geometric::BITstar(OMPL 1.4.2 — OMPL's currentBITstaris really Advanced BIT*, which drops the vertex queue).Unlike
RRTConnectPlanner, it returns the cheapest path it found rather than the first feasible one.The cost interface
CostFunction::state_costin the newcost_function.hppis the single stub to fill in. It takes oneConfig, and readscontext()— thevector<Config>of(x, y, theta)dependencies fixed at planner setup:std::vector<Config> cost_context = {{0.4, 0.1, 0.0}, {0.9, -0.2, 1.57}}; BITStarPlanner planner(&checker, bounds_min, bounds_max, cost_context); auto path = planner.plan(start, goal, BITStarPlanner::PlanParams{}); const double cost = planner.solution_cost();It returns
0.0today, so BIT* currently minimises weighted-SE(2) path length — runnable and testable before the real cost lands.Why there's a length term
A path is charged the line integral of the density
1 + state_cost. The1 +is load-bearing:heuristic_cost(plain distance) an admissible lower bound, which is what BIT*'s pruning and best-first ordering rest on;state_costis 0 — including today, with the stub.A cost that breaks the non-negative contract is clamped in
edge_costrather than left to corrupt the search. This is not theoretical: astate_cost < -1makes edge costs negative, lets a vertex be reparented under its own descendant, and spinsupdate_descendants()forever. Reproduced, then fixed.Verification
[bit_star].state_costtemporarily patched to a Gaussian penalty, the path detours around the costly region (cost 3.0 vs 14.5 straight through) — the cost plumbing genuinely steers the plan.edge_cost == distancebit-for-bit, andsolution_cost()equals the summed edge cost of the returned path exactly.start == goaland unreachable-goal cases terminate cleanly.Also in here
pyproject.tomlusedcmake.minimum-version, removed in scikit-build-core 0.8 —pip install -e .was failing outright. (Separate commit.)Planner.plan_bit_star(),bit_star_solution_cost(), and acost_contextkwarg. Existingplan()is unchanged.run_planner.py→run_rrtc_planner.py(pure rename) and addedrun_bit_star.py, which sweeps the batch budget so you can watch the cost fall.🤖 Generated with Claude Code