1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! # Sampling-based motion planning
//!
//! Sampling-based motion planners for continuous configuration spaces: RRT, RRT*, RRT#,
//! RRT-Connect, PRM, PRM*, SPARS, SPARS2, FMT*, BFMT*, BIT*, AIT*, SST, SST* and KPIECE.
//! The crate is `#![no_std]` with `alloc`.
//!
//! This is a **motion planning** crate. It is named `sampling-planning` because the crate name `motion-planning` was already taken on crates.io.
//!
//! ## Building blocks
//!
//! A [`Problem`] bundles everything a planner needs:
//!
//! - a [`StateSpace`] with a metric and interpolation, for example [`Euclidean`], [`So2`],
//! [`Se2`], or the car-like [`Dubins`] and [`ReedsShepp`];
//! - a [`Sampler`] that draws states, for example [`UniformBox`];
//! - a [`ValidityChecker`] for states and motions, which answers with a three-valued
//! [`Validity`]. Planners accept only [`Validity::Valid`]; [`Validity::Unknown`] is rejected
//! like [`Validity::Invalid`];
//! - a [`Steering`] function, for example [`StraightLine`];
//! - a start state and a [`GoalRegion`].
//!
//! Planners keep their nodes in a [`NearestNeighbors`] structure, [`LinearScan`] by default;
//! [`KdTree`] is much faster in low-dimensional Euclidean spaces and returns identical results.
//! Randomness always comes from a caller-provided [`rand_core::Rng`], so a seeded RNG makes a
//! run fully reproducible. Float math goes through `libm`, so results are also identical across
//! platforms.
//!
//! ## Example
//!
//! ```
//! use rand_core::SeedableRng;
//! use sampling_planning::{
//! Euclidean, GoalRegion, Problem, StraightLine, UniformBox, Validity, ValidityChecker,
//! trees::{RrtStar, RrtStarConfig},
//! };
//!
//! /// Free space everywhere.
//! struct Free;
//!
//! impl ValidityChecker<Euclidean<2>> for Free {
//! fn check_state(&self, _: &[f64; 2]) -> Validity {
//! Validity::Valid
//! }
//!
//! fn check_motion(&self, _: &Euclidean<2>, _: &[f64; 2], _: &[f64; 2]) -> Validity {
//! Validity::Valid
//! }
//! }
//!
//! let problem = Problem {
//! space: Euclidean::<2>,
//! sampler: UniformBox::new([0.0, 0.0], [10.0, 10.0]),
//! checker: Free,
//! steering: StraightLine::new(1.0),
//! start: [1.0, 1.0],
//! goal: GoalRegion::new([9.0, 9.0], 0.5),
//! };
//!
//! let mut rng = rand_pcg::Pcg64Mcg::seed_from_u64(7);
//! let gamma = 1.5 * RrtStarConfig::gamma_lower_bound(2, 100.0);
//! let mut planner = RrtStar::new(problem, RrtStarConfig::new(gamma, 1.0)).expect("valid problem");
//! planner.run(2000, &mut rng);
//!
//! let path = planner.best_path().expect("free space has a path");
//! assert!(path.cost < 12.0);
//! ```
//!
//! ## Planners
//!
//! - [`trees`]: [`Rrt`](trees::Rrt), [`RrtStar`](trees::RrtStar) (radius or k-nearest,
//! optionally informed), [`RrtSharp`](trees::RrtSharp) and the bidirectional
//! [`RrtConnect`](trees::RrtConnect), all over a [`Problem`].
//! - [`roadmaps`]: the multi-query [`Prm`](roadmaps::Prm) (PRM, PRM*, lazy PRM) and
//! the sparse roadmap spanners [`Spars`](roadmaps::Spars) and [`Spars2`](roadmaps::Spars2), and the batch
//! planners [`FmtStar`](roadmaps::FmtStar) and [`BfmtStar`](roadmaps::BfmtStar). They need no
//! steering function.
//! - [`informed`]: the batch-informed [`BitStar`](informed::BitStar) and
//! [`AitStar`](informed::AitStar).
//! - [`kinodynamic`]: [`Sst`](kinodynamic::Sst) (SST and SST*) and
//! [`Kpiece`](kinodynamic::Kpiece) over a [`Propagator`](kinodynamic::Propagator) that
//! forward-simulates controls.
//!
//! [`shortcut()`] and [`shortcut_random`] post-process any [`Path`].
//!
//! Not yet implemented: ABIT*, EIT*, multi-level KPIECE, and the SE(3) and compound state
//! spaces.
//!
//! Repository: <https://github.com/sunsided/sampling-planning>
extern crate alloc;
pub use GoalRegion;
pub use ;
pub use ;
pub use rand_core;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;