pub struct WithSteering<R, S> {
pub reach: R,
pub steering: S,
}Expand description
A reachability model paired with a separate steering function.
Implements Reach by delegating to WithSteering::reach and Steer by delegating
to WithSteering::steering, so it can be used wherever a planner expects a model that
steers itself.
§Examples
use robust_planning::{Reach, Steer, WithSteering};
use robust_planning::polyzonotope::SparsePolyZonotope;
use robust_planning::sampling_planning::StraightLine;
/// A model whose control is the nominal end state.
struct Setpoint;
impl Reach<2> for Setpoint {
type Control = [f64; 2];
fn propagate(
&self,
initial: &SparsePolyZonotope,
_: &[f64; 2],
cover: &mut Vec<SparsePolyZonotope>,
) -> SparsePolyZonotope {
cover.push(initial.clone());
initial.clone()
}
}
let model = WithSteering::new(Setpoint, StraightLine::new(1.0));
let (control, end) = model.steer(&[0.0, 0.0], &[3.0, 4.0]);
assert_eq!(control, end);
assert!((end[0] - 0.6).abs() < 1e-12 && (end[1] - 0.8).abs() < 1e-12);Fields§
§reach: RThe model that propagates reachable sets.
steering: SThe steering function that picks each edge’s control.
Implementations§
Source§impl<R, S> WithSteering<R, S>
impl<R, S> WithSteering<R, S>
Trait Implementations§
Source§impl<R: Reach<N>, S, const N: usize> Reach<N> for WithSteering<R, S>
impl<R: Reach<N>, S, const N: usize> Reach<N> for WithSteering<R, S>
Source§fn certify_collision(
&self,
initial: &SparsePolyZonotope,
control: &Self::Control,
set: &SparsePolyZonotope,
obstacle: &Polytope,
) -> Option<Vec<f64>>
fn certify_collision( &self, initial: &SparsePolyZonotope, control: &Self::Control, set: &SparsePolyZonotope, obstacle: &Polytope, ) -> Option<Vec<f64>>
Forwards to the wrapped model, so pairing a model with a steering function keeps its collision certificates.
Source§fn propagate(
&self,
initial: &SparsePolyZonotope,
control: &Self::Control,
cover: &mut Vec<SparsePolyZonotope>,
) -> SparsePolyZonotope
fn propagate( &self, initial: &SparsePolyZonotope, control: &Self::Control, cover: &mut Vec<SparsePolyZonotope>, ) -> SparsePolyZonotope
impl<R: PartialEq, S: PartialEq> StructuralPartialEq for WithSteering<R, S>
Auto Trait Implementations§
impl<R, S> Forget for WithSteering<R, S>
impl<R, S> Freeze for WithSteering<R, S>
impl<R, S> Move for WithSteering<R, S>
impl<R, S> RefUnwindSafe for WithSteering<R, S>where
R: RefUnwindSafe,
S: RefUnwindSafe,
impl<R, S> Send for WithSteering<R, S>
impl<R, S> Sync for WithSteering<R, S>
impl<R, S> Unpin for WithSteering<R, S>
impl<R, S> UnsafeUnpin for WithSteering<R, S>where
R: UnsafeUnpin,
S: UnsafeUnpin,
impl<R, S> UnwindSafe for WithSteering<R, S>where
R: UnwindSafe,
S: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.