Skip to main content

MotionModel

Struct MotionModel 

Source
pub struct MotionModel {
    pub max_ramp_us: f64,
    pub max_jerk_um_per_us3: f64,
    pub max_accel_um_per_us2: f64,
}
Expand description

Constant-jerk motion/timing model for AOD moves.

Holds the three timing constants and computes move durations from a waypoint path. Defaults to the FLAIR constants; construct with MotionModel::new to override them.

Fields§

§max_ramp_us: f64

Maximum amplitude ramp rate (amplitude units per µs). Must be > 0.

§max_jerk_um_per_us3: f64

Maximum jerk in µm/µs³. Must be > 0.

§max_accel_um_per_us2: f64

Maximum acceleration in µm/µs². Must be > 0.

Implementations§

Source§

impl MotionModel

Source

pub fn new( max_ramp_us: f64, max_jerk_um_per_us3: f64, max_accel_um_per_us2: f64, ) -> Option<Self>

Construct a motion model from explicit constants.

All three constants must be positive and finite. max_ramp_us and max_jerk_um_per_us3 appear as divisors; a non-positive max_accel_um_per_us2 drives t1 to zero (or negative), which makes the trajectory solver return NaN/negative durations. Returns None for any non-physical constant.

Source

pub fn flair() -> Self

The FLAIR constant-jerk motion model (alias for Default).

Source

pub fn const_jerk_min_duration_us(&self, max_dist_um: f64) -> f64

Minimum duration (µs) for a constant-jerk move over max_dist_um.

Solves the constant-jerk trajectory: below the acceleration cap the move is jerk-limited (four jerk phases); above it, two extra constant-acceleration phases are inserted.

The sign of max_dist_um is ignored (the absolute distance is used); a distance below ~1e-8 µm is treated as no move and returns 0.0.

Source

pub fn lane_duration_us( &self, waypoints: &[[f64; 2]], amplitude_delta: f64, ) -> f64

Compute lane duration (µs) from a waypoint path: ramp + Σ per-segment const-jerk duration + ramp.

The pick and drop ramps are always charged, so a path with no motion segments (fewer than two waypoints) still costs 2 * ramp rather than collapsing to a free move. amplitude_delta scales the ramp time; its sign is ignored.

Trait Implementations§

Source§

impl Clone for MotionModel

Source§

fn clone(&self) -> MotionModel

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 Copy for MotionModel

Source§

impl Debug for MotionModel

Source§

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

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

impl Default for MotionModel

Source§

fn default() -> Self

The FLAIR constant-jerk motion model.

Source§

impl PartialEq for MotionModel

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MotionModel

Auto Trait Implementations§

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.

§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,

§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a [MaybeRef].
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.