pub trait StateSpace {
type State: Clone;
// Required methods
fn dimension(&self) -> usize;
fn distance(&self, from: &Self::State, to: &Self::State) -> f64;
fn interpolate(
&self,
from: &Self::State,
to: &Self::State,
t: f64,
) -> Self::State;
// Provided method
fn is_euclidean(&self) -> bool { ... }
}Expand description
A continuous configuration space with a metric and a geodesic interpolation.
Planners use StateSpace::distance both to find neighbors and as the path cost. Bounds
are not part of the space: the Sampler decides where states come from
and the ValidityChecker decides where they may be.
Required Associated Types§
Required Methods§
Sourcefn dimension(&self) -> usize
fn dimension(&self) -> usize
The number of degrees of freedom; feeds the RRT*/PRM* connection radius.
Sourcefn distance(&self, from: &Self::State, to: &Self::State) -> f64
fn distance(&self, from: &Self::State, to: &Self::State) -> f64
The distance between two configurations.
The length of the shortest motion from from to to.
Must be non-negative, zero for equal states and satisfy the triangle inequality. It
should be symmetric; Dubins is the exception, because a forward-only car’s way back
is longer. Forward tree planners (Rrt,
RrtStar, RrtSharp,
Sst) always measure from a tree node to the target and
work with asymmetric distances. Planners that need symmetry: Prm
stores one cost per edge for both directions, the goal tree of
RrtConnect measures from the target to its nodes,
Spars2 keeps undirected edges, and
FmtStar, BfmtStar,
BitStar and KdTree assume a metric
for their neighborhoods and heuristics.
Provided Methods§
Sourcefn is_euclidean(&self) -> bool
fn is_euclidean(&self) -> bool
Whether states are coordinate vectors, StateSpace::distance is the Euclidean norm of
their difference and StateSpace::interpolate the straight line.
Samplers that exploit Euclidean geometry, such as the direct informed sampling of
UniformBox, check this before they assume it. The default is
false, which is always safe.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".