Skip to main content

WithSteering

Struct WithSteering 

Source
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>,
    ) -> Option<SparsePolyZonotope> {
        cover.push(initial.clone());
        Some(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: R

The model that propagates reachable sets.

§steering: S

The steering function that picks each edge’s control.

Implementations§

Source§

impl<R, S> WithSteering<R, S>

Source

pub const fn new(reach: R, steering: S) -> Self

Pairs reach with steering.

Trait Implementations§

Source§

impl<R: Clone, S: Clone> Clone for WithSteering<R, S>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: Debug, S: Debug> Debug for WithSteering<R, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R: PartialEq, S: PartialEq> PartialEq for WithSteering<R, S>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<R: Reach<N>, S, const N: usize> Reach<N> for WithSteering<R, S>

Source§

type Control = <R as Reach<N>>::Control

The control of the wrapped model.

Source§

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>, ) -> Option<SparsePolyZonotope>

Propagates initial under control. Read more
Source§

impl<R, S: Steer<N, C>, C, const N: usize> Steer<N, C> for WithSteering<R, S>

Source§

fn steer(&self, from: &[f64; N], toward: &[f64; N]) -> (C, [f64; N])

Picks the control that moves the nominal state from toward toward. Read more
Source§

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>
where R: Freeze, S: Freeze,

§

impl<R, S> Move for WithSteering<R, S>

§

impl<R, S> RefUnwindSafe for WithSteering<R, S>

§

impl<R, S> Send for WithSteering<R, S>
where S: Send, R: Send,

§

impl<R, S> Sync for WithSteering<R, S>
where S: Sync, R: Sync,

§

impl<R, S> Unpin for WithSteering<R, S>
where S: Unpin, R: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.