pub struct ControlSchedule<const C: usize> { /* private fields */ }Expand description
A validated piecewise-constant control history.
controls[i] owns [boundaries[i], boundaries[i + 1]); the final
boundary is included in the final segment. Boundaries are strictly
increasing. Backward propagation traverses the same intervals in reverse,
using the interval to the left of each encountered switching time.
Implementations§
Source§impl<const C: usize> ControlSchedule<C>
impl<const C: usize> ControlSchedule<C>
Sourcepub fn new(boundaries: Vec<f64>, controls: Vec<[f64; C]>) -> Result<Self>
pub fn new(boundaries: Vec<f64>, controls: Vec<[f64; C]>) -> Result<Self>
Constructs and validates a zero-order-hold control schedule.
§Errors
Returns an error unless there is at least one non-empty segment,
boundaries.len() == controls.len() + 1, every value is finite, and
the boundaries are strictly increasing.
Sourcepub fn boundaries(&self) -> &[f64]
pub fn boundaries(&self) -> &[f64]
Returns the switching boundaries.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether the schedule contains no segments.
Valid schedules are never empty; this method is supplied alongside
Self::len for collection-like APIs.
Sourcepub fn initial_time(&self) -> f64
pub fn initial_time(&self) -> f64
Returns the first boundary.
Sourcepub fn final_time(&self) -> f64
pub fn final_time(&self) -> f64
Returns the final boundary.
Sourcepub fn control_at(&self, time: f64) -> Result<[f64; C]>
pub fn control_at(&self, time: f64) -> Result<[f64; C]>
Returns the right-continuous control at a time inside the schedule.
At an internal switching time, the later segment owns the boundary. The final boundary returns the final segment’s control.
§Errors
Returns an error for non-finite times or times outside the closed schedule interval.
Trait Implementations§
Source§impl<const C: usize> Clone for ControlSchedule<C>
impl<const C: usize> Clone for ControlSchedule<C>
Source§fn clone(&self) -> ControlSchedule<C>
fn clone(&self) -> ControlSchedule<C>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const C: usize> Debug for ControlSchedule<C>
impl<const C: usize> Debug for ControlSchedule<C>
Source§impl<const C: usize> PartialEq for ControlSchedule<C>
impl<const C: usize> PartialEq for ControlSchedule<C>
impl<const C: usize> StructuralPartialEq for ControlSchedule<C>
Auto Trait Implementations§
impl<const C: usize> Freeze for ControlSchedule<C>
impl<const C: usize> RefUnwindSafe for ControlSchedule<C>
impl<const C: usize> Send for ControlSchedule<C>
impl<const C: usize> Sync for ControlSchedule<C>
impl<const C: usize> Unpin for ControlSchedule<C>
impl<const C: usize> UnsafeUnpin for ControlSchedule<C>
impl<const C: usize> UnwindSafe for ControlSchedule<C>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable 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>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.