Skip to content

2.2 Path planning

The core finds a collision-free path through a game pack and shapes it into a smooth curve. The sections below go through the visibility graph, the search, the spline, the clearance the planner prefers, the contact check and how a path threads a terrain crossing. This page is part of Core modules.

visibility_graph: Graph construction

The module builds a graph from the start and end nodes and the nodes placed around each obstacle, and joins every pair whose straight edge keeps the robot clear.

Construction:

  1. Add start and end as nodes 0 and 1.

  2. Add each obstacle corner’s miter node at the corner radius (robot_radius_m, or the swept outline’s circumradius). Polygon corners are read counter-clockwise whatever the authored winding. A convex corner sharper than 60 degrees also gets two bevel nodes, one on each edge’s offset line, because its clamped miter node stands closer than the radius to both edge lines.

  3. Drop corner nodes that a keep-in or the field bounds refuse.

  4. For every pair of nodes, sweep the robot (the radius circle, or the footprint outline) along the edge against every obstacle, and add the edge if it clears. A start or goal is parked against an obstacle when it stands within the radius of it in point mode, or with a footprint within the outline’s circumradius and overlapping it at the edge’s heading. An edge from a parked endpoint may stay in contact with that obstacle in one run from the endpoint and must end clear of it, unless both ends are parked against it, and the robot center may not cross it. An endpoint standing exactly on the obstacle’s boundary leaves along a face or away from it, because for an edge with an end on a shape’s boundary only passing through the interior counts as crossing (segment_enters_shape). The run comes no closer to the obstacle than the endpoint stands. In point mode the segment’s closest approach, at the shape’s vertices, a circle’s center or the segment’s ends, is no nearer than the endpoint’s distance. With a footprint the outline’s penetration depth, the shortest move that parts it from the obstacle, stays within the endpoint’s all along the edge, and it is exact by separating axes for the outline’s convex hull against a rectangle, a circle or a convex polygon. Both bounds carry a 1 mm tolerance, the bar the rule is measured against. In point mode a polygon that is not convex is read whole, by the distance to its true outline, as a convex one is, and when both ends are parked against it and contact forms a run from each, each run is held to its own end’s distance. With a footprint, whose depth the separating axes read only on a convex shape, it is read piece by piece. Each reflex corner is cut along its incoming side to the side it meets, until every piece is convex (a U comes apart into its two arms and its bar), and each piece bounds the edge by the ends in its band (overlapped by the outline), as pieces authored side by side would: the deeper such end’s depth, and full clearance from a piece no end reaches. A start or goal inside a route’s .avoid(Region), or a start inside a pack avoid zone it may leave, sets no bound on any of its pieces along its own contact run, so it may leave through the region’s interior, from an arm across the bar. Past that run’s end the other end’s bounds hold, and the edge leaves the region once, and its clearance band once. A rotating leg is swept, and its depth read, as the hull of its outline over the turn, which covers the robot at every heading along the leg. At a start, via or goal within that hull’s reach of an obstacle, the field edge or a keep-in’s edge, the hull stands deeper than the outline at any one heading, so a run held to the hull’s depth there can carry the turning outline past it. A turning leg with such an end, held or not, is certified again once profiled, each pose at its own heading (Replanner::turning_poses_clear): a contact run no deeper than its end’s own outline stands, measured by the hull of each interval’s turn, no other obstacle entered, and a wall crossed no farther than an end’s own outline crosses it. A start inside a custom avoid region, or inside a pack avoid zone it may leave (leavable_avoid_zones, the graph’s rule), exempts the region from its contact run while its center stays inside, while its heading holds, and while the outline turns its way out (ContactRun::leaves_from, leave_walk). The outline goes no deeper than the shallowest depth it has stood at so far, the exemption ends at the first pose where it stands apart, and it never meets the region again. Each interval is halved until every stretch either stays in contact or stays apart, settled by depths or gaps larger than any point of the outline moves across it. The stretch the outline leaves across is settled where it moves no more than 1 mm, the certificate’s depth tolerance. Each contact run is measured only as far as an interval asks of it (ContactRun::reaches). A run counts an interval only while the outline meets its obstacle at every sample before the interval’s last, so a center farther than the circumradius and 1 micrometre from the obstacle ends any run, and a run from either end is not asked past the first such center (ContactRun::first_apart). An obstacle with no such run is read at every interval without one. A certificate that fails early measures only the start of each run. Every shortcut below leaves each answer the same to the bit, checked against a plain reference certificate on 40,000 seeded certificates (turn_certificate_tests):

    • The turning hulls are made once per heading pair for the whole certificate (visibility_graph::TurnHulls), with the sines and cosines of headings already read kept by their bits. An obstacle’s convex pieces, their sides and their reach along each side are made once per run (ObstaclePieces), and a run keeps its last eight depths by the bits of their headings.
    • A run’s chord is held to its floor by one obstacle side alone when that side’s plane, read from the points the hull is taken of, leaves no part of the chord deeper (TurnHulls::sides_hold). The hull’s own planes reach no farther along that side, so the full depth reads the same. Three in four of the chords the turning probe’s runs measure end there.
    • Chords are read in chunks of 16 samples, each against only the obstacles whose widened boxes meet the box of the chunk’s centers, and the box of every chord and of every halved chord lies within it.
    • A chord’s outline test reads a rectangle apart, without the hull of the placements, when the outline placed at both ends stands past one of its sides by more than 1 micrometre (SweepCtx::placed_apart_from_rect).
    • The outline placed at each sample and each interval’s heading excursion, both ways, are made once per certificate. On the roboRIO these take the certificates of the 1,500-leg turning probe from 2,368 ms to 1,115 ms in all (2026-10-16). The plan cache keeps each certificate’s result by every bit of the trajectory and of what the certificate reads of the plan (PlanGraphCache::turn_certificate), 32 results and 2 MiB held by their keys at most, so a trajectory built again to the bit, as a route the cache kept builds it, is not certified again. A leg that fails is planned again so the robot turns where it stands clear, by its circumradius and 3 cm, of everything:
    • plan_turning_in_the_open leaves a parked start and reaches a parked goal along straight stretches at their own headings, from and to the nearest-on-the-way points that stand clear and from which the held outline presses no deeper than at the end, and turns between them. The stretches are vias and the turn is timed by keyframes at their distance fractions. A leg with keyframes partway along, a rotation target among them, is staged only at a parked start with a clear end. It leaves at its start heading, keeps each keyframe past the stretch at its place on the path, and makes the keyframes the stretch passes due in order, spread evenly from the stretch’s end to the next keyframe. A start inside a custom avoid region or a pack avoid zone leaves it before the outline turns, as a held or travel-facing leg does. Without this staging, 790 of the 3,200 footprint legs of a_leg_with_a_rotation_target_partway_leaves_an_avoid_zone_it_starts_inside (geometryAudit.rs) have no route (2026-10-27). The point a stretch runs to is searched among 1,280 points, out to 2 m from the parked end in 32 directions (straight_approach): the first, in the order they are tried, of those that make the way through it shortest. The points are read once, one tested only where its way is shorter than the best found before it. A point farther than the clearance from an obstacle’s box stands clear of the obstacle unmeasured, and the depths a stretch is held to are made once a point stands clear, of the obstacles a stretch can reach. a_straight_approach_is_the_one_a_full_search_finds compares the point taken with a search that sorts every point and measures every obstacle, to the bit.
    • plan_turning_in_place turns at rest at a clear start or goal and drives the route at the heading held there, for an end only the held outline reaches. A leg that starts already turning is not planned this way.
    • plan_holding_through_gaps, for a leg with no route for its swept hull only, routes the outline held at the start heading and schedules the turn where the path is wide enough, through the scheduler of the narrow-spot switch (plan_route_with_narrow_turns); failing that, from a clear start at rest, it does the same from each quarter-turn heading the leg’s turn passes, reached by a turn at rest. Each held heading makes at most eight passes of its own.

    The retries run for a leg whose swept hull has no route as well as for one that fails its certificate, so a turning leg passes a gap its hull does not fit at one held heading. A leg with the narrow-spot switch and no route is refused. On 2026-11-14 a leg these retries newly plan took 0.7 ms at the median and 2.8 ms at the 99th percentile on x86, and one that still has no route 0.4 ms and 2.1 ms, over 2,000 seeded legs in each of ten classes on the 2026 field. On the ten-leg autos of the Field pack, 63 of 85 plans that had found no route found one, and the planning-time gate’s sum rose from 1,652 to 1,800 ms on the bench roboRIO and from 148 to 162 ms on the bench SystemCore; the shipped pack’s sum moved by under 1%. Read plan by plan on the bench roboRIO the same day, the Field pack’s 34 newly routed plans spent 208 ms of its first pass in the retries: 197 ms in the attempts that found the plans (120 ms the 32 that turn at rest at an end, 78 ms the two held at a quarter-turn heading) and 11 ms in the attempts before them. The plans still without a route spent under 0.1 ms there. The rest of the rise was offset by 75 ms of plans the autos no longer made. With the stretch search read in one pass (above) and the scheduler’s clearances read apart unmeasured (Narrow-span heading holds), the two quarter-turn plans take 33 ms, the retries of legs that fail their certificate 107 ms over both passes where they took 209 ms, and the gate’s sum reads 1,616 ms on the roboRIO and 146 ms on the SystemCore, against 1,650 and 148 ms before the gap retries, every plan the same to the bit (measured 2026-11-14).

    Each candidate passes the same certificate, and the retries make at most eight planning passes, counted inside each candidate, and a leg none certifies has no route. A leg with holds (HeadingSpec::holds_enabled) takes a retry only if the retry turns over no chord between samples that meets a Rotation Lock’s hold, and, with the narrow-spot switch on, only where its center along every chord it turns across stands farther than the circumradius and the obstacle margin from everything. The narrow-span planner’s own plan holds every Lock exactly and may turn in a narrow spot only with its narrow-turn warning. A leg that cannot hold its Lock has no plan to retry, so a retry never turns inside a Lock. A leg that faces its travel exactly is left to the graph and spline certificates, which sweep its outline turned to its travel. A leg whose heading lags its travel under a rate or acceleration bound, or from a turn under way, is planned on the circumscribed disk and certified here like any other. The certificate sweeps each interval over every heading the plan’s profile takes in it, read from the profile’s turning points, so a whole turn between two samples of one heading is seen. On 1,500 seeded shipped-pack routes (2026-10-15) no route that planned clear before is lost. The 7 turning routes with an end within the circumradius that pressed up to 5.9 cm into an obstacle, and 168 with an end overlapping one that pressed up to 20.7 cm deeper than that end, now plan clear but for 4, each with an end in a trench or within 10 cm of one, which have no route. Of 382 routes with an end pressed 2 mm into a hub, tower or trench face, all 371 that planned plan clear, and 64 had clipped by up to 17 cm. With holds, the 57 of 318 routes that pressed deeper than an end plan clear. Point-mode builds skip, unswept, the edges of a corner node that stands inside another obstacle’s radius band.

Two sets of nodes go beyond these, the second built only when a graph with the first finds no route. A plan whose start or goal is parked against an obstacle it does not stand inside, or stands where the field bounds let no corner node stand, builds with the first set from the start (PlanSweep::needs_own_nodes), because corners alone could route it the long way round where those nodes give a shorter route. Every other plan builds its corners first and adds the first set only when they find no route.

  1. Arc, wall-band and slide-out nodes. A convex corner that lost a node in step 3, or whose node would already put the robot into another obstacle, gets the usable nodes of its exterior arc, at most 30 degrees apart and padded like a circle’s ring. The corner and arc nodes the field bounds refuse, clear of every obstacle and with their centers inside the field, are wall-band candidates. A plan enables those that stand no nearer each wall than the end nearer that wall, so a robot parked between an obstacle and the wall rounds the obstacle at the wall distance it already stands, and the rest stand in its graph with no edge. An end outside the field bounds counts only for a candidate on its own way in: within two corner radii of it (OUTSIDE_END_REACH), or within two corner radii of an obstacle it is parked against. An edge from it to any node comes into the field within two corner radii past its way straight in (EdgeRules::comes_in), as does a smoothing shortcut from or into it (comes_into_bounds). A parked start or goal gets slide-out nodes, for a gap too narrow to leave straight away from the face. Behind a tower 1 m off the wall at the 0.51 m radius, for example, the field bounds drop every corner node. The slide lines run through the endpoint parallel to each face it stands on or outside of and within reach of, and along the line that supports the obstacle’s convex hull at its nearest point (a circle’s tangent), and no point of that line stands nearer the hull. A held or rotating footprint also slides along the side of its overlap region (outline and obstacle’s Minkowski difference) nearest the endpoint, along which its depth cannot rise. Each line is followed both ways until it leaves the clearance region of every obstacle it runs into: the faces moved out by the corner radius, cut by a tangent chord at a corner sharper than 60 degrees, or a circle grown by it. The node there stands clear of every obstacle, as a corner node does, and is kept only when the endpoint’s own edge reaches it.
  2. Contact nodes and outline corners. A parked end’s contact run may go on over several legs. In point mode a contact node is one of the arc nodes round a corner of an obstacle the end is parked against, circumscribed at the end’s own distance so that every point of the arc sees one of them, at half the arc nodes’ spacing (45 degrees round a right angle, out 1.08 times the distance) unless a node that far out would stand the radius off the corner or be refused, and with a held or rotating outline a corner of the centers at which it stands exactly as deep in that obstacle as the end. A contact node up to the 1 mm tolerance nearer or deeper than its end keeps to its run’s edges, and any other edge at it is anchored there and may come the tolerance deeper than the node. A robot parked against a hexagonal hub follows it round at the depth it stands. An edge within a run keeps no nearer or deeper to the end’s obstacles than the end, stays in contact with the obstacles both its nodes touch, and lets contact with the others end once but not begin again. Along the start’s run contact may end but not begin, and along the goal’s it is the reverse. A held or rotating outline reads contact piece by piece as well (EdgeRules::touches_within). Along the start’s run a node touches no piece the node before it does not, and a piece’s depth floor is the end’s only while contact with it lasts, so each piece has one contact run from each end. The outline’s overlap with a convex piece is concave along a straight edge, so an edge stays in contact with each piece both its nodes touch. A run is entered only from its start and left only toward its goal, so those edges are one-way. Outline corners are a held or rotating outline’s exact corner nodes, the corners of the centers at which it touches each convex piece of an obstacle, 1 micrometre out, because corner nodes at the circumradius stand too far off to pass a gap the outline fits.

Wall-band nodes a plan enables, and slide-out and contact nodes, are not held to the radius-eroded field bounds or keep-ins. They stand no nearer a wall or a keep-in’s edge than an end does, and never with the center past it. An outline that turns with its edges reaches its circumradius toward the wall from such a node, but may face along the wall at its end and reach only its least half-width. The end then counts that much farther off, so the body at the node overhangs the wall no more than at the end, whichever way either is turned. Every node of a route then stands inside the bounds widened to take in both ends, a box, so no leg comes nearer a wall than an end. A polygon that is not convex slides, clears and is followed by its convex pieces. Neighbouring pieces that share a stretch of a cut merge into their convex hull where its outline runs within 0.5 mm of the pieces’ sides all along and every corner of theirs lies within 0.5 mm of it (merge_pieces), so a traced outline’s jitter does not cut it into slivers and no merged piece spans a notch of free space. A footprint’s depth read on a merged piece is held 0.5 mm under its end’s to keep within the 1 mm tolerance of the outline. Arithmetic and square roots place every node, so native and wasm32 builds put them on the same bits. An edge driven into a node the start reaches directly, or out of one that reaches the goal directly, is never shorter than that direct edge, so where it touches one of the plan’s own nodes it is not swept. A build that adds no node to the one before is skipped. Each build’s corners extend the one before’s, sweeping only the pairs its new nodes make. The first plan of a cached key to need them adds them for itself unswept (CornerSubgraph::lazy), sweeping only what its search needs, and routes as it would over swept ones. It records what it made on the key’s entry (RetryBakes), and a background thread bakes those corners into the entry, every pair swept, for the plans after it with the same inputs to the bit, which take them as they are. A plan at another heading within the key’s tolerance makes its own, with the bake landed or not, so no route depends on when a bake lands. The corners read no endpoint, so only a key some plan needed the retries of is baked, and no plan waits on the bake (Kept). A route’s construction groups its authored endpoint pairs by exact geometry inputs in drive order (AutoRuntime::bake_route_retries), and each distinct key gets one background job. Direct legs and endpoints that the key’s barriers or physical obstacles refuse need no retry bake. A leg that starts with its own nodes or whose corner-only graph finds no route bakes the arc stage, and the wall stage only when an endpoint enables a wall candidate. A search of that first retry on a scratch entry decides whether contact and outline corners are needed too, and it changes no plan-visible slot. Plans from other endpoints make any missing stages on demand. Workers share each exact warm set across routes, with one construction writer at a time, and readers never take that writer’s lock. A stage that adds no corner shares the preceding stage’s adjacency rows. A warm-up keeps its corners apart from the entry’s slots, in a set for its plans’ inputs to the bit (WarmRetries), because a key matches headings within its tolerance, and retry corners made 5e-10 rad apart can route a plan apart. A plan with those inputs that finds a slot empty takes the set’s corners, the ones it would make, and any other plan makes its own, as it would with no warm-up. The auto’s first tick cancels the warm-up’s bakes and those plans over the pack asked for, and no bake over a pack starts a slot while an auto over that pack runs, so on a roboRIO’s single worker a look-ahead plan waits for its route’s bakes no longer than one check, and for another route’s no longer than the slot in hand. A plan’s bake stopped that way hands its slots back to the entry for the next plan that needs them. The tick takes no lock a plan’s thread can hold. It counts the auto with an atomic and cancels the plans’ bakes on the first loop that finds their list free, and a plan that lists its bake after an auto has started cancels it itself. An auto stops counting as running when it ends, by a tick or a host’s signal. A plan without a cache adds them the same way and asks for no bake. On wasm32, which has no background thread, the first plan to get that far bakes them into the entry. An endpoint row to a corner swept in an earlier build of the plan is not swept again.

A held or rotating outline’s edge test builds the convex hull of the outline placed at both ends and runs polygon_intersects_shape against each obstacle the swept box reaches, and a spline certificate does the same at a Bezier interval’s four controls. The test is settled clear without the hull when the hull stands 10 nm apart from the obstacle along one of the outline’s sides or the edge’s normal (Clearance::separates). With the obstacle’s axes, which the box test covers, those are every side of a convex outline swept along a segment, and the polygon test reads segments that far apart as apart. It is settled blocked without the hull when the outline placed somewhere on a segment between two of the centers covers a vertex of the obstacle by 1 micrometre (Clearance::engulfs), at once where the vertex lies inside the outline’s inner disc about the path: that vertex lies as far inside the hull, where the hull test’s ray-cast containment reads it exactly. A travel-aligned outline is read apart the same way once turned to face its edge (SweepCtx::turned_apart). On the ten-leg autos of leg_plan_time.rs these settle all but about 2% of the held and rotating hull tests (2026-10-09). The certificates hold for centers and shapes within SEPARATE_DOMAIN_M (1e4 m), where every placement and projection rounds by less than 1e-10 m, and only where every side of the outline’s hull bounds every vertex of the outline (sides_bound) and every direction they project onto is a unit vector within 1e-12, and otherwise the hull test decides. An edge’s normal comes from a scaled norm, and an edge shorter than 1 nm gives none. Hulls are wound by the exact sign of their area (geometry::ring_area_sign), so a sliver whose rounded area has the wrong sign still gets outward normals.

A point plan sweeps its start and goal rows whole, and so does a deferring cache’s first plan of a key. A pair of any other node with one of the plan’s own nodes, or with a corner its build left unswept, is a candidate (EdgeRules::candidate: its directions, dominance, band masks, and a center that crosses no obstacle) until a route needs it (EdgeRules::settle), and so is a pair of the start or goal with a node when the plan sweeps a footprint, whose sweeps cost more than the searches a swept row would prune. The contact runs are swept first, a contact node off its end’s run left out. Then a few searches each sweep the route found up to its first failing edge. Past those, connects settles whether any route clears, growing the start’s reach and the goal’s in turn, and shortest runs A* guided by the shortest way to the goal over every edge left, sweeping an edge only when a node is first reached across it. Every pair of the route found is swept, since smoothing reads those edges, and the candidates left are dropped. The route is the shortest over the edges that clear, as a build that swept every pair would find.

Polygons of 8 or more vertices are planned against a coarser outline that covers them when one exists (planning_obstacles), and concave outlines qualify. An edge leaving a start or goal within reach of such an obstacle judges it by its authored outline, so an endpoint clear of the real outline but inside the coarser one’s band is held to the full clearance instead of being treated as touching it. A contact run against such an obstacle is placed and judged by the authored outline too (SweepCtx::run_shape): its contact nodes, their contact sets and every run edge’s depth, contact and crossing tests.

Circular obstacles become a ring of 12 nodes (CIRCLE_NODES). The ring radius is padded by 1 / cos(pi/12) so the polygon circumscribes the clearance circle and a chord between adjacent ring nodes never cuts inside it.

pathfinding: Dijkstra + smoothing

find_path returns Option<PlannedPath>. Its arguments, in order:

ArgumentType
pack&GamePack
start, endPoint2d
allianceAlliance
robot_radius_mf64
avoid_mask, cross_masku64
extra_obstacles&[Obstacle]
keep_in&[KeepIn]

avoid_mask selects which avoid zones count as obstacles for this plan. cross_mask marks terrain the segment is allowed to cross. Crossed terrain is treated as free space, and any terrain not crossed is a hard obstacle routed around. find_path_with_footprint adds an optional RobotFootprint and a SweepHeading. The cached variant also accepts PlanGraphCache, shared by the auto runtime and standalone replanner construction paths.

  1. Check a direct visible chord when the shortcut preserves the full-graph result. Endpoint escape or containment exemptions use the graph path.
  2. Otherwise build VisibilityGraph, reusing the baked corner subgraph on a cache hit and checking the current start/end visibility rows.
  3. Run Dijkstra (standard priority queue, O(E log V)).
  4. Run smooth_path(), which drops a waypoint when its neighbors have clear LOS.
  5. Return PlannedPath { waypoints, total_distance_m } or None.

The plan cache keeps more than corner graphs, each served only where the computation it stands for gives the same bits, so a plan served from it is the plan computed in full:

  • The routes of its latest 64 plans, keyed by every input to the bit and tied to the graph entry the plan read. Headings within the key’s tolerance share an entry, whose corners are baked at the heading of the plan that entered it, so a route stands only while that entry is in the cache. A repeat counts a use of the entry, and a plan whose entry has gone plans in full, so the entry list is the one full plans leave.
  • Spline certificates, by everything a certificate reads (obstacles, swept outline, radius, keep-ins, field bounds) and each segment’s ends and tangents.
  • In the editor’s deferring cache, the speed bounds velocity profiling bisects, by an interval’s length and turn, the limits and its end speeds, in a direct-mapped table. Physical-only robot plans profile without it, and preferred-margin plans enable it because candidate comparisons and junction negotiation revisit interval bounds.
  • The convex pieces of each polygon a plan reads piece by piece, by the bits of its vertices, shared by every key of the pack. A key’s bake splits the polygons its plans can read, so a plan over a baked key splits none itself.
  • The coarser planning outline of each dense polygon (planning_outline), by the bits of its vertices and the radius, which a plan and the spline fit after it each read.

A routed preview plans every group of an auto again on each move of a drag, and again for every junction speed, boundary tangent and aim bearing it settles. The editor’s deferring cache also keeps, past each plan’s route (plan_reuse.rs):

  • Each plan by every input it reads, with the route lookups it made in order. A plan with the same inputs asks the cache for the same routes in the same order, which counts the same uses, and is served only when each is still the route recorded, and otherwise it plans in full.
  • Each spline fit by every input the fit and its certificates read.
  • Each sample grid by its segments’ bits. A grid takes a segment sampled before at the same index and spacing, since a sample is evaluated at the segment’s index plus its fraction, and adds the arc length up again in order from the first sample, because a change before a segment shifts every arc length after it.
  • Each profile’s sweeps: the speeds every step of the forward and backward passes and the interval bounds read and made. A later profile takes a step whose geometry, carried speed and input speed are the bits an earlier step read, under the same limits, and a changed start speed rejoins the earlier sweep where a ceiling holds both.

The records are bounded by count and by bytes with every variable part counted, 20 MiB at most, and a record larger than its kind’s share is not kept. The plans take 10 MiB of that in two stores of 256 records each. A leg’s finished plan, the one plan_route_with_head_and_waypoints hands back after the contact check, is kept in 2 MiB of its own, and the candidates made on the way to it share the other 8 MiB, so a leg whose candidates overflow their store is still served whole when it is planned again. A finished plan is served like any other, only while each route it looked up is still the route recorded, and a leg with a bias or inside a counted retry scope is planned in full, since its diagnostics and passes belong to the attempt. An auto whose legs carry an angular acceleration limit keeps 66 plans at the median and 123 at the 90th percentile on the ten-leg autos of leg_plan_time.rs (2026-11-18), and under 96 records and 3 MiB such an auto planned again found none of them (2026-11-14). A one-target drag on a ten-group auto replans the groups the move and its junctions reach, and the rest cost a lookup and a copy. Physical-only robot-side caches keep none of these records, but preferred-margin routes enable them for authored vias or smooth junctions, so repeated junction negotiation can reuse the fits and profiles it revisits. A replan from a changed live pose still misses every record whose inputs differ.

PlanGraphCache::deferring(), the editor preview’s cache, bakes a key on its second plan. A key’s first plan builds over its corner nodes with its start and goal rows swept and every corner pair pending, sweeps the pairs a route could take and then every pending pair on a way from start to goal no longer than the route found (within a relative 1e-9), and so takes the full build’s route, ties included. Its entry waits unbaked at the place a bake would hold, and a lookup that matches it within the heading tolerance bakes it from the first plan’s key. Plans with a parked end, and first plans that find no route, bake as in any cache. Robot-side caches bake on the first plan.

A key’s barriers settle many plans that find no route before any search (Barriers). Each convex part of every obstacle, read by its authored outline, is a blocker, and its region is the centers that put a body inside every body the plans sweep into it, 10 um to spare: a held or turning outline’s hull shrunk toward the robot center, else the circle a point robot or an outline that turns with its edges holds at every heading. Blockers whose regions meet are linked through a point of both, and a region that reaches past a wall is linked to the field’s outside. No route enters a region, and none leaves the field bounds, so a cycle of links that the segment from start to goal crosses an odd number of times walls them apart, and the plan returns no route. A plan also links to the outside every region that reaches 1 um past its node box (SweepCtx::node_box): the centers at which the field bounds admit a corner node, widened to take in both ends. Every node of the plan stands in that box (corner, arc and outline-corner nodes where the bounds admit them; wall-band, slide-out and contact nodes no nearer a wall than the corner nodes or an end), so its route does too. The obstacles a contained end may come into are left out, as is a plan with an end outside the field bounds. So is an obstacle a parked end may come into, unless it is a rectangle, a circle or a small convex polygon and the outline is held or turning (PlanSweep::parked_depths). No edge takes the hull deeper into it than the deeper end stands, beyond the 1 mm contact tolerance at a contact node and again at an edge anchored there, so its region for the plan is the centers at which the hull, shrunk by that depth and 3 mm, still overlaps it. The bake makes the barriers. A plan over a baked key asks them before it builds, without those regions, and again with them at its retries when it has any. The plan that enters a key, and a plan with no cache, asks once its first build finds no route, which for a plan that builds with its own nodes first is its first retry, where most such plans route. A plan with no cache makes the barriers only when convex sets holding every region (each obstacle’s box grown by the body’s bounds, or, for one whose box holds an end, the obstacle’s hull plus the scaled swept hull) can wall its ends apart (PlanSweep::may_be_walled), and when they cannot, neither can the barriers. On the Field pack the trench bars, bumps and hub wall each alliance zone from the neutral zone for a turning 0.88 m square and a 0.622 m point robot. On the shipped pack a turning square whose hull spans more than a trench’s 1.2793 m passage is walled from the other half of the field. A plan over a key it read, or with no cache, also returns no route before it builds when its start or goal stands 1 mm or more inside a physical obstacle it may not escape or come into, because every edge from that end carries the robot center across the obstacle’s outline, which every edge test refuses. On the 1,500 seeded turning legs of turning_leg_plan_time (2026-10-16, no cache) these answer 208 of the 228 legs with no route before any retry and 15 more before the contact retry.

Returns None when start or end is inside a physical obstacle, when fewer than 2 waypoints remain, or when no path exists. Terrain containing the start or end is crossable for that plan, allowing a robot standing on a bump to drive off it. Such a plan reads a key of its own, with that terrain dropped from its hard set, and a route’s build bakes the keys of the legs whose authored ends stand on terrain (AutoRuntime::group_drop_masks). Such an entry is baked ahead of the first plan of its key (CacheEntry::ahead), as is every base graph baked before a plan needs it. Only a plan of the bake’s inputs to the bit reads it, because a key matches headings within its tolerance, and an edge admitted at one heading can be refused 5e-10 rad away. Any other plan of the key plans as with no such entry and enters its own in its place. A custom avoid region containing the start also permits escape, and the region constrains the route after the robot leaves it. So does a pack avoid zone on for the plan that holds the start and not the goal (leavable_avoid_zones), but a zone holding the goal stays solid and refuses it. Authored targets inside custom avoid regions are rejected, including intermediate targets and targets beyond a background plan’s initial distance budget.

A leg whose target position equals its start can still be valid, because position arrival is already satisfied but an authored rotation can require a timed turn and heading-aware completion. Equal XY coordinates alone do not imply that the leg completes on its first tick.

A leg can also fail to plan with collision-free geometry, because plan_route_with_head returns None when the profile has zero duration and the robot is still farther from the target than the arrival tolerance, and that is what an undriveable velocity envelope produces. Review failure handling at each caller, including initial planning, replan replacement, skipped-leg diagnostics and runOnFailure, and verify the host-visible result.

spline: Cubic Hermite with Catmull-Rom tangents

Entry point: Spline::fit_catmull_rom(waypoints: &[Point2d]) -> Option<Spline>

It requires at least two waypoints and estimates tangents this way:

  • Interior: T_i = 0.5 * (p_{i+1} - p_{i-1})
  • Endpoints: T_0 = p_1 - p_0, T_n = p_n - p_{n-1}

Two more general builders back the path editor. fit_with_modes picks a SegmentMode per segment, and Straight segments set both endpoint tangents to the chord, so the cubic collapses to an exact line. fit_with_tangents also accepts per-waypoint tangent overrides. The plain editor preview (plan_preview’s tx/ty) passes a waypoint’s Bias through them.

A Bias (Bias.toward(direction, reach), segment JSON bias: [dx, dy], routed preview targets[].bias) sets the curve’s direction where the route passes a waypoint, and its reach is the distance from the waypoint to the Bezier control point of each cubic beside it. A cubic Hermite segment’s inner control points sit a third of its end tangents in from its ends (spline_bezier_controls), so the boundary tangent is bias_tangent_from_handle(bias), three times the vector (BIAS_TANGENT_PER_REACH), the one place the factor is defined, and the runtime and the routed preview both read it. A handle moved 1 m off a straight path moves the curve’s peak 4/9 m. The runtime writes the tangent into boundary_tangents[1] of the plan arriving there and boundary_tangents[0] of the plan leaving, with biased_boundaries set on those ends, so a leg arriving at a biased waypoint never merges with a neighbor (can_merge) and a leg leaving one plans on its own too (leaves_a_bias, mirrored in the preview’s splits_apart_from_heading), and the junction negotiation keeps the bias as that junction’s tangent. So each side of a bias is judged only against the one leg it shapes, and a detour the next leg needs never shortens it. A biased end keeps up to BIASED_TANGENT_CHORDS (3) chords to the neighboring waypoint, so graph corners and subdivision do not shorten it. Any other boundary tangent is clamped to the adjacent route chord, and on a leg of two knots one that leaves that chord at an angle is shortened to the shortest handle, down to a quarter of the chord, whose end segment stays within the curvature the leg’s top speed allows (shorten_boundary_handles, certified over the cubic), since a longer one only bows the leg. 4774’s 5.36 m sweep leg between two through junctions bowed 0.57 m off its chord at 1.75 m/s and now bows 0.21 m, 0.08 s sooner. Travel-facing, differential, mecanum and steering-rate-limited legs keep the chord-long handle. Before the fit through the graph’s points, a biased plan tries the curve its bias authors through the route’s own points alone and keeps it where every segment certifies and the biased ends neither loop nor hook, so a bias whose curve bows clear of an obstacle the straight chord meets is planned as drawn. A fit whose biased end segment collides, crosses itself (segment_loops; automatic tangents keep the per-axis segment_reverses_between_tangents test, which would reject the bend a bias asks for), hooks (segment_hooks: forward, back and forward along its chord, a near stop inside, or, at a graph corner or subdivision point, a turn tighter than half the robot’s radius), or loses the tangent’s direction fails, and records why (replanner::take_bias_rejections: the obstacle hit, a loop, or what the segment with the bias would have done where the fit gave up its direction). The runtime (plan_leg_with, prepare_junctions) and the routed preview then shorten that side of the bias by BIAS_SHRINK_FACTOR (0.7), up to BIAS_SHRINKS (8) times, so the reach kept is within 30% of the longest that fits, and the direction stays. With a bias at each end of a plan, only the one whose leaving out alone lets the plan certify is shortened. The first shorter bias that certifies is kept for every later plan of the leg on that side (AutoRuntime::bias_shares, by waypoint and side, BIAS_ARRIVING and BIAS_LEAVING) and reported once with bias_shortened_warning. When none does, the whole bias is tried clamped to the adjacent route chord as a negotiated tangent is (biased_boundaries false, AutoRuntime::bias_clamped), which keeps the direction of a bias beside a graph corner, and is reported the same way. When that fails too, the junction or leg plans as it would without the bias, the bias stays out of every later plan on both sides, and both report bias_collision_warning (texts in tests/fixtures/api/bias.json). In prepare_junctions and plan_leg_with, a plan that leaves the leg’s crossings out (dropped_crossing) counts as failing while a boundary tangent is still in it and a plan without the tangents keeps the crossings, so a bias that bends a leg away from its bump is shortened, clamped or dropped before the crossing is. Taking such a plan first left the crossing out of a leg after a waypoint whose bias pointed past the hub in a team’s REBUILT auto, on 22 of 85 simulated drivetrain lags and accelerations (2026-10-27). Every plan made on the way still takes its exit-speed retry. Junction negotiation’s pass window grows by BIAS_SHRINKS + 2 per bias stage, so a junction whose bias and blend both fail still settles. The routed preview reports the reach each bias was planned with, by waypoint the shorter side’s (PreviewPlan::take_bias_reaches) and two to a waypoint, arriving then leaving (take_bias_side_reaches), and why, in plain words (take_bias_reasons, take_bias_side_reasons, bias_rejection_words). The editor marks each handle end from its own side and draws the real plan while a handle is dragged, planning again on every move.

The start pose carries an optional bias too (route JSON startBias, preview start.bias, AutoRuntimeConfig::start_bias), as waypoint 0. It becomes the first plan’s boundary_tangents[0] only when that plan leaves within the default translation tolerance of the start pose from rest, and a coasting or interrupted drive replaces it with the robot’s velocity. It shrinks and drops like any bias, with its warnings opening Start: (bias.json startLabel) where a waypoint’s open with the leg that ends there. The authoring check refuses a start bias that is not along plus or minus the start heading on a differential first leg (fixture tests/fixtures/api/authoringRefusals.json).

The trajectory builder samples a spline by a Sampling. Uniform(n) takes n samples of every segment. Spaced, the planner’s (PROFILE_SAMPLING), takes 50 of every segment of a spline of up to 16 segments, which is every spline a fit makes without subdividing. A subdivided fit lays dozens of short pieces along a route’s graph chords: one leg of the ten-leg autos fits five waypoints over 5.6 m with 106 segments, 5,301 samples a millimetre apart at 50 each. On such a spline a segment that lies on its chord takes one sample per centimetre of the chord and no fewer than four. Its samples and the chords between them lie on the segment at any count, so nothing its certificate proved is lost. A segment that bends keeps the 50 its certificate split it by, and so does a straight segment that meets a corner (a knot where the direction changes at once), because a leg facing its travel turns there nearly standing and the stretch it crawls is one sample spacing wide. Sampling::knot_indices gives the sample index of each knot, which the crossing windows, knot speed caps and waypoint times read in place of a multiple of 50.

Method on SplineResult
evaluate(s: f64)Point2d, with s in [0, segment_count]
tangent_at(s: f64)Vector2d
arc_length(samples_per_segment: usize)f64, meters

The s parameter is the polynomial segment index plus a fraction, so s = 1.5 is halfway through the second segment regardless of that segment’s length, and the trajectory builder converts to arc length.

Preferred obstacle clearance

ReplannerConfig::obstacle_margin_m specifies space beyond the physical body. Bindings and routed wasm previews default to 0.10 m, and zero preserves physical-only planning. Route JSON carries config.obstacleMarginM and routed preview JSON carries obstacle_margin_m, and the margin participates in plan and warm-plan identity. The C ABI keeps its existing struct layout and accepts an override through tempo_replanner_new_with_margin_v1, and older constructors use the default.

The graph uses the physical footprint at every preference value, and an unobstructed segment keeps its straight geometry when a sweep against expanded obstacle boxes proves the requested gap. A held outline uses its oriented extents, including deployed extensions.

clearance_margin moves automatic corners outward along their angle bisectors. Each move is limited to a quarter of the shorter adjacent chord and its two chords may grow by at most 2%, and authored endpoints and vias keep their coordinates. A quick candidate moves toward the target gap, with a corner-speed and acceleration estimate at most 3% longer than the physical shape, or 1.5% for a docked footprint whose endpoint may require a straight arrival or escape chord. An expensive estimate keeps the physical shape. A quick candidate that keeps every waypoint, anchor and curve mode of the physical shape is the physical plan, so where it fails past its shape the physical plan is not made again (ClearancePasses::quick_unshifted), except inside a turning retry’s count of passes, which it would spend. A leg facing its travel beside an obstacle fitted, profiled and failed its heading certificate twice that way: 162 passes of the ten-leg autos under a binding’s angular limits, 4.4% of their plan time on x86 (2026-11-14). A complete profile comparison is used for a change that disables larger corner rounding, and for smooth junctions, differential followers, straight curve styles and added passage knots. A compared candidate must finish within 2.5% of the physical plan and retain its sampled transit clearance to within 0.1 mm. These are shape-selection rules, and the physical spline certificates and ordinary velocity, acceleration, steering and heading limits still apply.

Travel-facing fits keep their free corners and center narrow passages. Parallel rectangular faces, including the field border, define the available center interval, and an asymmetric outline is centered by its swept extents. A straight chord through an off-center narrow opening may gain entry and exit knots, and its complete profile is compared with the physical chord. The preference adds no passage speed cap, and a physical retry preserves reachability whenever a preferred candidate fails. Rotating legs with an authored endpoint touching the swept envelope keep their physical shape, because moving the path changes where its heading turns.

One immutable passage layout is retained per planning thread, keyed by pack contents, alliance, avoid and crossing masks, and custom obstacles. Full candidate comparisons share one physical graph search and reuse bounded interval-speed calculations, and routes that negotiate junctions also retain exact fits and profiles in the existing bounded plan cache. Geometry, constraints, heading and margin all participate in reuse.

The 10 cm target combines approximately 5 cm of follower position error with approximately 5 cm of field-placement variation. Physical footprint dimensions, the 0.1 micrometer outline skin, the 1 mm endpoint-depth tolerance, and the 1 nm curve-contact tolerance serve separate geometry contracts.

Contact check

A leg facing its travel with no heading profile (no rate or acceleration limit) takes the travel tangent at every sample. The graph sweeps its outline turned to each edge and the spline certificates sweep it along each curve, and the turning certificate (Replanner::turning_poses_clear) never reads it. Two turns fall outside every one of those models:

  • A start at rest snaps from its own heading to the tangent between the first two samples, and beside a wall or an obstacle the outline’s corners swing into it, up to 16 cm on the leg plan time corpus.
  • A corner between two path segments turns the heading at one point, which no segment’s certificate sweeps, and in a narrow passage the corners swing 0.2 to 8 mm into what the passage runs between.

contact_sweep::first_entry (rust/core/src/contact_sweep.rs) reads those turns on the trajectory the follower is handed: the first sample interval, and every interval whose heading turns by more than TANGENT_STEP_RAD (0.1 rad). On a curve the tangent turns by less between two samples, and the trajectory’s pose there strays from the curve the certificates swept only by second-order terms. Every other heading is left to the certificates that already read it. A held outline and a disk are swept exactly, and a heading with keyframes or a profile is certified pose by pose where it turns beside contact.

It checks the obstacles the plan routes around (Replanner::pose_obstacles: the pack’s for the alliance and avoid mask, terrain the leg does not cross and that holds neither end nor an authored via, and the alliance’s custom obstacles) and each field wall on its own. Overlapping, the outline’s depth is the shortest move that parts its hull from the deepest convex part of the obstacle, since outline_shape_clearance reads a hair below zero where only edges cross.

The check reads cheap bounds before it measures anything:

  • The box the body sweeps over an interval, the chord’s box plus the box of each hull corner’s arc about the center, is read against each obstacle’s box and each wall first. Most plans’ turns stand clear of everything and stop there, before the checked obstacles are drawn up.
  • An interval whose box comes near something is continuous in time. Where the heading holds and the center moves along the chord, the test is exact. Elsewhere no point moves farther than the center’s travel plus the reach times the heading’s sweep, and an interval whose ends clear by more than that clears. Any other is halved, its box read again at each half, at most 30 times and 32,768 poses in one check, past which it reads as entering.
  • A clearance is read once per sample and obstacle, and an outline whose box stands apart from an obstacle’s box reads the gap between the boxes. A polygon’s convex parts are cut once per thread.
  • A plan a cache keeps carries the verdict and any moved turns the check made of it to every copy the cache serves (Trajectory::contact_kept), and each thread keeps 4,096 verdicts of checks that measured something, by every bit they read, because a junction’s negotiation plans the legs the auto then plans again to the bit. Every method that changes a trajectory’s samples, headings or clock drops what it carried.

A pose deeper than 1 um (CONTACT_NOISE_M) is inside. Contact at the start, the end and each authored via the trajectory passes through is the route’s own, and an interval with an end in the run of samples in contact around such a point is left out, where the graph’s parked-end rules govern it. A leg that starts where the leg before it ended inside a wall owns that contact the same way.

A plan that enters something gives way, in order (Replanner::kept_out):

  1. The same plan with each turn that enters something moved to where the disk of the body’s reach clears every obstacle and wall at two samples in a row (turned_where_clear), either put off until the disk next clears, or brought forward to where it last cleared, one turn at a time. A snap beside a parked start moves away from the start, and a corner’s turn out of the passage. Where that does not keep out, the turn is spread evenly over the samples to where the disk next clears, or over 25 or 50 samples, the short way or the long way round (ramped_turn). Then every turn is held where the disk is not clear, and then the start heading is held to the end. A moved heading faces no tangent, so every interval with a moved end is checked. The results are kept for the process by every bit they read, since a junction’s negotiation plans the legs the auto then plans again to the bit.
  2. The leg planned holding the heading it starts at (Replanner::contact_fallbacks), which turns the outline nowhere. For a leg facing its travel whose start stands within its outline’s reach of something, the bake ahead builds that plan’s graph while the robot is disabled (Replanner::contact_fallback_graph).
  3. The leg routed for the disk of its reach, facing its travel and then holding its start heading.
  4. The leg planned for its body grown by 1 cm, then 3 cm (CONTACT_FALLBACK_MARGINS_M).

A leg whose plans all enter something has no route, and the runtime treats it as any leg without one.

A leg facing its travel under an angular acceleration limit, which every binding writes (outputAngularAccelerationRadS2), leads and trails its travel through every bend and start turn, so it is routed for the disk of its outline’s reach. Where that disk finds no route, at a start or end parked within its reach of something or a gap narrower than the disk, the leg falls back (Replanner::plan_lagging_travel_off_the_disk) to its own outline facing its travel, routed twice: turning from its start heading as it drives (with the turn made at rest first where that plan’s lagging turn fails, trajectory::StartTurnAtRest), and turning in place to its departure first, its departure read from the same route faced exactly (Replanner::plan_lagging_travel_aligned). Each is kept where every pose its heading drives clears (Replanner::turning_poses_clear) and it stays out as above, and the faster of those kept is the plan. With neither, the leg holds the heading it starts at under the same two checks. Where every outline plan of the first attempt is refused by its turning certificate at a corner the plan turns through standing (under 0.01 m/s) or along a stretch it drives facing its travel exactly, the leg plans holding its start heading next, and plans the turn at rest and aligned only when holding has no plan either. This is a different order, not the same plan for every leg: the turn made at rest also changes the heading the whole leg is retimed under, so it can pass where the first outline was refused. Over 40,000 seeded legs (2026-11-14) no leg lost its plan; under the limits a binding writes for the guides swerve none planned differently, and at 9.42 rad/s and 12.57 rad/s^2 two legs hold their start heading where the turn at rest had a plan, arriving 1.18 s and 0.75 s sooner. The order reads only what each outline plan computes itself, never a kept certificate or a kept plan, so it is the same whatever the caches hold. A plan kept facing its travel is weighed once more where its path has a corner in it (two chords of its samples more than 0.201 rad apart, as on a route laid along its graph chords where no curve cleared) and it takes more than 1.5 times as long as its own length driven in a line under the leg’s speed and acceleration limits (Replanner::far_slower_than_its_path): the leg also plans holding its start heading and keeps the faster of the two. Such a plan slows to turn at each corner, and the turning certificate refuses or passes it by where the heading profile happens to place the turn; on the Field pack’s 40 ten-leg autos (2026-11-18) seven then drive 0.06 to 5.1 s sooner, one drives 0.18 s later (its next leg leaves the junction after the held leg slower) and one drives a leg it skipped before. An outline plan facing its travel whose start outline stands more than a nanometre outside the field bounds or a rectangular keep-in is refused before it is profiled (Replanner::start_outline_stands_out): the turning certificate fits every interval’s swept hull inside those, so it refuses the first interval of that plan and of the two plans tried after it, which start at the same pose. A keyed leg entered shedding a residual turn rate (Replanner::sheds_only_a_residual_rate) that finds no route plans as the same leg from rest does, under the same checks (Replanner::plan_residual_rate_from_rest). A plan with a route takes neither fallback. A cache that keeps plans keeps each fallback’s result under a key naming the fallback (PlanKey::of_fallback), so the same inputs plan it once. On the leg_plan_time.rs corpus with a 9.42 rad/s cap and 12.57 rad/s^2 (2026-11-04), 538 of its 5,760 legs are skipped with the fallbacks and 1,067 without them, against 530 with no angular limits, and the 1,322 routes that make no failed plan plan the same to the bit either way.

A replan checks each join back onto the line the same way (Replanner::stays_out). A join that enters something is passed over for the next join, and a replan left with none plans a fresh path and warns that the way back is blocked.

traversal: Per-crossing geometry

The module decides which point(s) a path threads through one terrain crossing for the ordered .cross(Terrain) API. A Crossing carries the terrain index, an allowance_m wire field (twice the physical crossing depth; 0 = minimal clip), and an anchor flag the replanner manages (Replanner and auto runtime). Bindings expose depth as Terrain.crossingDepth(distance) in Java and Terrain.crossing_depth(meters) in Python/C++. crossing_vias returns entry and exit points when the direct leg already traverses the terrain, or a single via on the boundary otherwise, pushed toward the centroid as the depth grows. This anchor displacement does not bound total route length, and required targets supply their own crossing line and exclude positive automatic depth.

Those points are read off the straight leg, and Replanner::reachable_anchor_on moves one the body cannot sit at to the nearest point that holds it. Replanner::plain_crossing_anchors keeps them unless the route through them kinks, a turn past 120 deg at a point or two opposite turns of at least 60 deg each within twice the body reach of it. On CRESCENDO the stage’s legs stand at the terrain’s corners, so a straight leg’s two moved points landed on opposite sides of a leg, and the route overshot each one and came back. A kinked route gives way to the shortest route with the terrain free, which needs no point when it runs at least twice the obstacle margin plus 5 cm inside the terrain and nothing follows it on the leg, and otherwise threads one point: nearest the middle of the straight crossing, the route’s deepest point on the terrain, or the point adding the least distance, whichever first has no kink and is no longer than the original. Each goes as deep as the straight crossing did, up to that same depth, so a leg over the terrain keeps a real pass and does not clip a corner. A leg with no such point keeps the points it was given, and so does a leg that also has a crossing with a target, whose line is part of its route.

A leg whose crossing has nowhere to hold the body, or whose crossing points have no route, drives on as a plain leg with that terrain an obstacle and says so: the runtime prints and logs notice::dropped, and the routed preview returns Replanner::dropped_crossing_warning, which the editor lists under the leg’s waypoint.

esc

Loading search...