robust_planning/lib.rs
1//! # Robust planning
2//!
3//! Planning over reachable sets under uncertainty: Robust-RRT and reachability-guided search.
4//!
5//! Every check in this crate is conservative. A check that cannot prove safety answers
6//! [`SafetyVerdict::Indeterminate`], never [`SafetyVerdict::Safe`], and planners reject
7//! anything that is not proven safe.
8//!
9//! ## Building blocks
10//!
11//! - [`Reach`]: propagates a reachable set along one edge under one control. Implement it for
12//! your dynamics, or enable the `reach` feature for the models in `models`, built on
13//! polyzonotope-reach.
14//! Its optional [`Reach::certify_collision`] hook lets a model whose sets are exact turn an
15//! unproven edge into [`SafetyVerdict::Unsafe`] with a [`Witness`]; [`check_edge`] runs
16//! one edge check.
17//! - [`Steer`]: picks the control of one edge. Implement it on the model, or pair a model
18//! with a steering function through [`WithSteering`]; `sampling-planning`'s
19//! [`StraightLine`](sampling_planning::StraightLine) steers models whose control is a
20//! setpoint.
21//! - [`Cost`]: how planners price an edge: the nominal length, or the length plus a weight
22//! times the width of the edge's end set (a robustness-weighted cost).
23//! - [`Obstacles`]: polytope obstacles, checked against reachable sets with optional
24//! refinement by splitting.
25//! - [`Goal`]: a goal region tested against whole reachable sets. [`PolytopeGoal`] is a
26//! convex polytope in H-representation; it answers
27//! [`Containment::Inside`](polyzonotope::Containment::Inside) only when the set is proven
28//! inside.
29//! - [`proven_within`] and [`decide_within`]: prove one set inside a zonotope in up to four
30//! dimensions, through polyzonotope's set-in-polytope test on an inner
31//! H-representation with rigorously rounded facets.
32//! - [`ReachChecker`]: a [`sampling_planning::ValidityChecker`] that runs a [`Reach`] model
33//! along each motion, so `sampling-planning`'s planners only accept proven-safe edges.
34//! - [`RobustRrt`]: an RRT whose nodes carry the reachable set they are reached with.
35//! - [`RobustRrtStar`]: the RRT* variant of [`RobustRrt`]. Choose-parent and rewiring accept
36//! only proven-safe edges, and a rewire re-propagates and re-proves the whole moved
37//! subtree before it commits.
38//! - [`ReachSearch`]: A* over reachable-set nodes along a fixed set of motion primitives,
39//! expanding only proven-safe edges, with deduplication on a lattice of nominal states.
40//!
41//! ## The `sound` feature
42//!
43//! Without `sound`, polyzonotope computes in plain `f64`, so [`SafetyVerdict::Safe`] means
44//! "safe up to floating-point rounding". Only with `sound` (outward rounding) is it a proof.
45//! See `docs/design.md`.
46//!
47//! Repository: <https://github.com/sunsided/robust-planning>
48
49#![forbid(unsafe_code)]
50
51mod checker;
52pub mod containment;
53mod cost;
54mod goal;
55#[cfg(feature = "reach")]
56pub mod models;
57mod node;
58mod obstacles;
59mod reach;
60pub mod robust_rrt;
61pub mod robust_rrt_star;
62pub mod search;
63mod steer;
64mod verdict;
65
66pub use checker::ReachChecker;
67pub use containment::{decide_within, proven_within};
68pub use cost::Cost;
69pub use goal::{Goal, PolytopeGoal};
70pub use node::Node;
71pub use obstacles::Obstacles;
72pub use reach::{Reach, check_edge};
73pub use robust_rrt::RobustRrt;
74pub use robust_rrt_star::RobustRrtStar;
75pub use search::ReachSearch;
76pub use steer::{Steer, WithSteering};
77pub use verdict::{SafetyVerdict, Witness};
78
79pub use polyzonotope;
80#[cfg(feature = "reach")]
81pub use polyzonotope_reach;
82pub use sampling_planning;