Trait drv8825::traits::MotionControl[][src]

pub trait MotionControl {
    type Velocity: Copy;
    type Error;
    pub fn move_to_position(
        &mut self,
        max_velocity: Self::Velocity,
        target_step: i32
    ) -> Result<(), Self::Error>;
pub fn reset_position(&mut self, step: i32) -> Result<(), Self::Error>;
pub fn update(&mut self) -> Result<bool, Self::Error>; }

Implemented by drivers that have motion control capabilities

A software-based fallback implementation exists in the motion_control module, for drivers that implement SetDirection and Step.

Associated Types

type Velocity: Copy[src]

The type used by the driver to represent velocity

type Error[src]

The type error that can happen when using this trait

Loading content...

Required methods

pub fn move_to_position(
    &mut self,
    max_velocity: Self::Velocity,
    target_step: i32
) -> Result<(), Self::Error>
[src]

Move to the given position

This method must arrange for the motion to start, but must not block until it is completed. If more attention is required during the motion, this should be handled in MotionControl::update.

pub fn reset_position(&mut self, step: i32) -> Result<(), Self::Error>[src]

Reset internal position to the given value

This method must not start a motion. Its only purpose is to change the driver’s internal position value, for example for homing.

pub fn update(&mut self) -> Result<bool, Self::Error>[src]

Update an ongoing motion

This method may contain any code required to maintain an ongoing motion, if required, or it might just check whether a motion is still ongoing.

Return true, if motion is ongoing, false otherwise. If false is returned, the caller may assume that this method doesn’t need to be called again, until starting another motion.

Loading content...

Implementors

impl<'r, T> MotionControl for RefMut<'r, T> where
    T: MotionControl
[src]

type Velocity = <T as MotionControl>::Velocity

type Error = <T as MotionControl>::Error

impl<Driver, Timer, Profile, Convert> MotionControl for SoftwareMotionControl<Driver, Timer, Profile, Convert> where
    Timer: CountDown,
    Driver: SetDirection + Step,
    Profile: MotionProfile,
    Convert: DelayToTicks<<Profile as MotionProfile>::Delay, Ticks = <Timer as CountDown>::Time>,
    <Profile as MotionProfile>::Velocity: Copy,
    <Convert as DelayToTicks<<Profile as MotionProfile>::Delay>>::Ticks: TryFrom<Nanoseconds<u32>>,
    <Convert as DelayToTicks<<Profile as MotionProfile>::Delay>>::Ticks: Sub<<Convert as DelayToTicks<<Profile as MotionProfile>::Delay>>::Ticks>,
    <<Convert as DelayToTicks<<Profile as MotionProfile>::Delay>>::Ticks as Sub<<Convert as DelayToTicks<<Profile as MotionProfile>::Delay>>::Ticks>>::Output == <Convert as DelayToTicks<<Profile as MotionProfile>::Delay>>::Ticks
[src]

type Velocity = <Profile as MotionProfile>::Velocity

type Error = Error<<Driver as SetDirection>::Error, <Driver as Step>::Error, <Timer as CountDown>::Error, <<Timer as CountDown>::Time as TryFrom<Nanoseconds<u32>>>::Error, <Convert as DelayToTicks<<Profile as MotionProfile>::Delay>>::Error>

Loading content...