Trait ramp_maker::MotionProfile [−][src]
Abstract interface for motion profiles
Implemented by all motion profiles in this library. Can be used to write abstract code that doesn’t care about the specific motion profile used.
Associated Types
type Velocity
[src]
The type used for representing velocities
type Delay
[src]
The type used for representing delay values
Required methods
fn enter_position_mode(&mut self, max_velocity: Self::Velocity, num_steps: u32)
[src]
Enter position mode
In position mode, the motion profile will attempt to move for a specific number of steps and come to a stand-still at the target step.
The number of steps given here is always relative to the current position, as implementations of this trait are not expected to keep track of an absolute position.
fn next_delay(&mut self) -> Option<Self::Delay>
[src]
Return the next step delay
Produces the delay for the next step. The unit of this delay is
implementation-defined. None
is returned, if no more steps need to be
taken. This should only happen, if the motion has ended.
Please note that motion profiles yield one value per step, even though only n-1 delay values are needed for n steps. The additional delay value will lead to an unnecessary delay before the first or after the last step. This was done to make accidental misuse of this trait less likely, as the most straight-forward use is to make one step per delay value in a loop.
All other details of the motion profile are implementation-defined.
If you need an iterator that produces the step delays, you can get one
by calling MotionProfile::delays
, which internally calls this
method.
Provided methods
fn delays(&mut self) -> Delays<'_, Self>ⓘ
[src]
Return an iterator over delay values of each step
This is a convenience method that returns an iterator which internally
just calls MotionProfile::next_delay
.
fn velocities(&mut self) -> Velocities<'_, Self>ⓘNotable traits for Velocities<'r, Profile>
impl<'r, Profile> Iterator for Velocities<'r, Profile> where
Profile: MotionProfile,
Profile::Delay: Inv<Output = Profile::Velocity>, type Item = Profile::Velocity;
[src]
Notable traits for Velocities<'r, Profile>
impl<'r, Profile> Iterator for Velocities<'r, Profile> where
Profile: MotionProfile,
Profile::Delay: Inv<Output = Profile::Velocity>, type Item = Profile::Velocity;
Return an iterator over velocity values of each step
This is a convenience method that returns an iterator which internally
calls MotionProfile::next_delay
and converts the delay to a
velocity.
This is mainly useful for testing and debugging.
fn accelerations<Accel>(&mut self) -> Accelerations<'_, Self, Accel>ⓘNotable traits for Accelerations<'r, Profile, Accel>
impl<'r, Profile, Accel> Iterator for Accelerations<'r, Profile, Accel> where
Profile: MotionProfile,
Profile::Delay: Copy + One + Inv<Output = Profile::Velocity> + Add<Output = Profile::Delay> + Div<Output = Profile::Delay>,
Profile::Velocity: Sub<Output = Profile::Velocity> + Div<Profile::Delay, Output = Accel>, type Item = Accel;
[src]
Notable traits for Accelerations<'r, Profile, Accel>
impl<'r, Profile, Accel> Iterator for Accelerations<'r, Profile, Accel> where
Profile: MotionProfile,
Profile::Delay: Copy + One + Inv<Output = Profile::Velocity> + Add<Output = Profile::Delay> + Div<Output = Profile::Delay>,
Profile::Velocity: Sub<Output = Profile::Velocity> + Div<Profile::Delay, Output = Accel>, type Item = Accel;
Return an iterator over the acceleration values between steps
This is a convenience method that returns an iterator which internally
calls MotionProfile::next_delay
and computes the acceleration from
each pair of delay values.
This is mainly useful for testing and debugging.
Implementors
impl<Num> MotionProfile for Flat<Num> where
Num: Copy + Zero + Inv<Output = Num>,
[src]
Num: Copy + Zero + Inv<Output = Num>,
type Velocity = Num
type Delay = Num
fn enter_position_mode(&mut self, max_velocity: Self::Velocity, num_steps: u32)
[src]
fn next_delay(&mut self) -> Option<Self::Delay>
[src]
impl<Num> MotionProfile for Trapezoidal<Num> where
Num: Copy + PartialOrd + Cast<u32> + Zero + One + Inv<Output = Num> + Add<Output = Num> + Sub<Output = Num> + Mul<Output = Num> + Div<Output = Num> + Ceil,
[src]
Num: Copy + PartialOrd + Cast<u32> + Zero + One + Inv<Output = Num> + Add<Output = Num> + Sub<Output = Num> + Mul<Output = Num> + Div<Output = Num> + Ceil,