pub struct SplineConfig {
pub order: usize,
pub parametrization: Parametrization,
pub s_min: f64,
pub s_max: f64,
pub out_of_range_mode: OutOfRangeMode,
pub start_state: Option<DMatrix<f64>>,
pub end_state: Option<DMatrix<f64>>,
}Expand description
Configuration for waypoint-spline path construction.
The default is a quintic spline on s in [0, 1] with zero endpoint
derivative boundary conditions and out-of-range errors.
Most callers use this type through
Path::from_waypoints rather than
constructing SplinePath directly.
§Example
The example below customizes the waypoint parameter range and endpoint derivative conditions for a two-dimensional quintic spline.
use copp::path::{OutOfRangeMode, Parametrization, Path, SplineConfig};
use nalgebra::DMatrix;
let waypoints = DMatrix::from_row_slice(
2,
3,
&[
0.0, 0.5, 1.0,
0.0, 0.2, 0.0,
],
);
// For order 5, m = 2, so each endpoint state is `(dim x 2)`:
// column 0 is velocity and column 1 is acceleration.
let start_state = DMatrix::from_row_slice(2, 2, &[0.0, 0.0, 0.0, 0.0]);
let end_state = DMatrix::from_row_slice(2, 2, &[0.0, 0.0, 0.0, 0.0]);
let cfg = SplineConfig {
order: 5,
parametrization: Parametrization::Uniform,
s_min: 0.0,
s_max: 2.0,
out_of_range_mode: OutOfRangeMode::Error,
start_state: Some(start_state),
end_state: Some(end_state),
};
let path = Path::from_waypoints(&waypoints, cfg)?;
assert_eq!(path.dim(), 2);Fields§
§order: usizeSpline order: must be an odd number >= 3.
parametrization: ParametrizationWaypoint parameter assignment policy.
s_min: f64Lower endpoint of the path parameter range.
s_max: f64Upper endpoint of the path parameter range.
out_of_range_mode: OutOfRangeModeBehavior when evaluating outside [s_min, s_max].
start_state: Option<DMatrix<f64>>Boundary derivatives at s_min: shape (dim, m) where m = (order-1)/2.
Column r (0-indexed) = (r+1)-th derivative value.
None = all-zero (default).
end_state: Option<DMatrix<f64>>Boundary derivatives at s_max: same shape as start_state.
None = all-zero (default).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SplineConfig
impl RefUnwindSafe for SplineConfig
impl Send for SplineConfig
impl Sync for SplineConfig
impl Unpin for SplineConfig
impl UnwindSafe for SplineConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.