Expand description
Optimal ordering and orientation of required robot paths.
Given a set of paths that must each be traversed exactly once — some of which may be reversible or have several interchangeable realizations — this crate chooses one option per required path and orders them to minimise total motion cost, starting at a configuration and optionally ending at one. It returns the full stitched motion: connector segments interleaved with the chosen required paths.
The ordering is an asymmetric generalized TSP (see [agtsp]); cost is a
pluggable joint-space metric (TransitionCost). The planner is only used
to generate connector paths and is optional — plan_multipath uses a
planner for obstacle-aware connectors, plan_multipath_straight emits
validated straight-line connectors instead.
let settings = MultiPathSettings::new(start);
let cost = TransitionCost::JointWeighted(weights);
let transition = TransitionPlanner { planner, config: cfg, make_waypoints: make_wp };
plan_multipath(&paths, &cost, &settings, &transition, validator, ctx)§Feature flags
rayon— use rayon to plan connectors concurrently and to fan out the heuristic’s seed tours. Worth enabling when connector planning is the bottleneck (real collision-checked RRT, where each plan costs milliseconds) or for large heuristic instances; for trivially cheap connectors the thread-pool dispatch can cost more than it saves. The exact Held–Karp solver stays sequential — its layers depend on one another, so it does not parallelize without a structural rewrite. Enabling it addsSyncbounds on the planner, its config, the waypoint builder, and the validator context (all satisfied by the deke planners/validators).
Structs§
- Multi
Path Settings - Knobs for a multipath solve. Build with
MultiPathSettings::new. - Transition
Planner - Everything needed to generate real connector paths with a deke planner. The
make_waypointsclosure bridges the planner’s associatedWaypointstype — for the RRT planners that is|s, e| StartEnd { start: s, end: e }.
Enums§
- Multipath
Error - Failure modes specific to multipath solving, layered over
DekeErrorfor the underlying planning / validation / path-construction failures that flow up from the deke primitives. - ReqPath
- A path that must be traversed exactly once, with the directions or variants
the solver is free to choose between. Every variant collapses to a set of
directed option paths; the solver picks exactly one option per
ReqPath. - Transition
Cost - How a transition between two configurations is scored when ordering the required paths. This drives the AGTSP only — the connector paths in the output are produced separately (by the planner or by straight-line segments).
Functions§
- plan_
multipath - Solve the ordering and stitch the full motion using
transitionto plan obstacle-aware connectors between the chosen paths. - plan_
multipath_ straight - Solve the ordering and stitch the full motion using straight joint-space
connectors. Each connector is checked with
validator.validate_motion; if a straight line between two required paths is infeasible the solve fails (there is no planner to route around the obstacle). - weighted_
distance - Weighted joint-space distance
sqrt(Σ (wᵢ·(aᵢ-bᵢ))²). Note this is notSRobotQ::distance, which is unweighted.