Skip to content

nav: plan_vehicle_route, routes a vehicle with a turning circle can drive (P9 R1) - #704

Merged
transfix merged 4 commits into
masterfrom
feat/nav-vehicle-routes
Oct 19, 2026
Merged

transfix merged 4 commits into
masterfrom
feat/nav-vehicle-routes

Conversation

@transfix

Copy link
Copy Markdown
Owner

The first step of vehicle-aware routes (Joe: "start vehicle-aware routes").

The problem

grid_nav::astar plans for a point that turns on the spot. On the Jolt plant (#702) a Humvee has a 6.7 m turning circle and a 4.8 m body. In the Austin finale it wedges where its route asks for a turn tighter than that circle, or a U-turn in a narrow street.

The planner

plan_vehicle_route (inc/cvc/nav/vehicle_route.h) is a Hybrid A* over the rear axle's pose (x, y, heading):

  • Moves: arcs of 1.5 cells at curvatures −1…1 × 1/min_radius, forward or backing up.
  • Collision: each footprint disc must stay clear of the walls, sampled on the grid's exact distance transform (edt2_squared).
  • Cost: the length driven. Backing up costs 2×, each cusp 4 steps more. Steering and steer changes add a little, and so does coming nearer a wall than comfort.
  • Heuristic: the free-space distance to the goal, weighted 1.5 (weighted A*: a route at most 1.5× the cheapest).

The output is poses with gear, so a dead end or a too-tight corner becomes a multi-point turn. A wedged start, already touching a wall, may stay as close as it is for its first moves, so the route leads it out. route_clearance checks a pose. Nav-only: it doesn't depend on #702, and takes the footprint as plain offsets and radius (#702's plant_plan_of provides them).

Measured (nav_vehicle_route_test, 7 tests; Humvee on 1 m cells)

Case Result
Open ground, goal 70 m ahead Straight, 70 m, no cusps
Goal behind in the open Turns within its circle
8 m dead end, facing its end Backs out (42 m); nav's bicycle turns round in the street
Right angle between 9 m streets Forward, 106.5 m, 93 expansions
Wedged, nose 0.4 m into the wall First move backs away
Enclosed goal Reported unreached, within the expansion budget
384 m city (40 m blocks, 12 m streets) 648 m in 740 expansions, 8 ms (exact: 636 m, 168k expansions, 0.63 s)

Every route turns no tighter than the vehicle can and keeps its body clear of the walls.

Next

  • R2: following a route with reverse segments in sim_world (a command override for backing up and stopping at cusps).
  • R3: the finale and cvcdbg plan routes with it, and replan a wedged vehicle.

…rive (P9 R1)

grid_nav::astar plans for a point that turns on the spot. The physics plant's Humvees (a 6.7 m
turning circle, 4.8 m long) wedge where such a route asks for a turn tighter than their circle or
a U-turn in a narrow street.

plan_vehicle_route is a Hybrid A* over the rear axle's pose (x, y, heading):
- arcs of 1.5 cells at five curvatures up to 1 / min_radius, forward or backing up;
- every footprint disc kept clear of the walls on the grid's exact distance transform;
- the cost is the length, with backing up dearer (2x) and each cusp dearer still (4 steps), a
  little for steering and its changes, and for coming near a wall;
- the heuristic is the free-space distance to the goal, weighted 1.5 (weighted A*).
A dead end or a tight corner comes back as a multi-point turn (reverse poses between cusps); a
wedged start may stay as close as it is for its first moves, so the route leads it out.
route_clearance checks a pose's footprint.

nav_vehicle_route_test (7, the Humvee on 1 m cells): straight across open ground; it turns round
within its circle; it backs out of an 8 m dead end the bicycle turns round in; it takes a corner
between 9 m streets; it leads a wedged vehicle out; it reports an enclosed goal; and it crosses a
384 m city in 740 expansions and 8 ms (heuristic x1: 168,000 and 0.63 s, a route 1.9% shorter).
Every route turns within the circle and keeps the body clear.
… on its own grid

On Austin's 7.8 m cells (3 km on 384) a 1.5-cell move is 11.7 m, which turns a Humvee 100 degrees
in one arc, and keying the closed set on the occupancy cells prunes moves that stay in a cell. The
default step is now at most 0.6 x min_radius and the closed set is keyed at step / 1.5. On the
tests' 1 m cells the Humvee's routes are unchanged. The bicycle (a 1.03 m radius) searches finer
and turns in the dead end with a 1.2 m backing nudge.
The exact search took 6.06 s in the Linux Debug package builds against a 5 s limit. The weighted
searches stay under 5000 expansions (740 and 586) on any machine.
@transfix
transfix force-pushed the feat/nav-vehicle-routes branch from 7f224fb to 10de8ac Compare October 19, 2026 02:50
@transfix
transfix merged commit 1c93cb2 into master Oct 19, 2026
17 checks passed
@transfix
transfix deleted the feat/nav-vehicle-routes branch October 29, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant