Command

Enum Command 

Source
pub enum Command {
    Position(f32),
    Velocity(f32),
    Acceleration(f32),
}
Expand description

A command for a motor to perform: go to a position, run at a velocity, or accelerate at a rate.

Variants§

§

Position(f32)

Where you want to be. This should be in millimeters.

§

Velocity(f32)

How fast you want to be going. This should be in millimeters per second.

§

Acceleration(f32)

How fast you want how fast you’re going to change. This should be in millimeters per second squared.

Implementations§

Source§

impl Command

Source

pub const fn new(position_derivative: PositionDerivative, value: f32) -> Self

Constructor for Command.

Examples found in repository?
examples/devices.rs (line 4)
4const COMMAND: Command = Command::new(PositionDerivative::Position, 5.0);
Source

pub fn get_position(&self) -> Option<Quantity>

Get the commanded constant position if there is one. If the position derivative is velocity or acceleration, this will return None as there is not a constant position.

Source

pub fn get_velocity(&self) -> Option<Quantity>

Get the commanded constant velocity if there is one. If the position derivative is acceleration, this will return None as there is not a constant velocity. If the position derivative is position, this will return 0 as velocity should be zero with a constant position.

Source

pub fn get_acceleration(&self) -> Quantity

Get the commanded constant acceleration. If the position derivative is not acceleration, this will return 0 as acceleration should be zero with a constant velocity or position.

Trait Implementations§

Source§

impl Add for Command

Source§

type Output = Command

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl AddAssign for Command

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for Command

Source§

fn clone(&self) -> Command

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Command

Source§

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

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

impl Div<f32> for Command

Source§

type Output = Command

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Self

Performs the / operation. Read more
Source§

impl DivAssign<f32> for Command

Source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
Source§

impl From<Command> for PositionDerivative

Source§

fn from(was: Command) -> Self

Converts to this type from the input type.
Source§

impl From<Command> for Quantity

Source§

fn from(was: Command) -> Self

Converts to this type from the input type.
Source§

impl From<Command> for f32

Source§

fn from(was: Command) -> f32

Converts to this type from the input type.
Source§

impl From<State> for Command

Source§

fn from(state: State) -> Self

Converts to this type from the input type.
Source§

impl<E: Copy + Debug> Getter<Command, E> for Terminal<'_, E>

Source§

fn get(&self) -> Output<Command, E>

Get something.
Source§

impl<E: Copy + Debug> History<Command, E> for MotionProfile

Source§

fn get(&self, time: Time) -> Option<Datum<Command>>

Get a value at a time.
Source§

impl Mul<f32> for Command

Source§

type Output = Command

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Self

Performs the * operation. Read more
Source§

impl MulAssign<f32> for Command

Source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
Source§

impl Neg for Command

Source§

type Output = Command

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl PartialEq for Command

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<G: Getter<State, E> + ?Sized, E: Copy + Debug> Settable<Command, E> for CommandPID<G, E>

Source§

fn get_settable_data_ref(&self) -> &SettableData<Command, E>

As traits cannot have fields, get functions and separate types are required. All you have to do is make a field for a corresponding SettableData, make this return an immutable reference to it, and make get_settable_data_mut return a mutable reference to it.
Source§

fn get_settable_data_mut(&mut self) -> &mut SettableData<Command, E>

As traits cannot have fields, get functions and separate types are required. All you have to do is make a field for a corresponding SettableData, make this return a mutable reference to it, and make get_settable_data_ref return an immutable reference to it.
Source§

fn impl_set(&mut self, command: Command) -> NothingOrError<E>

Set something, not updating the internal SettableData. Due to current limitations of the language, you must implement this but call set. Do not call this directly as it will make get_last_request work incorrectly.
Source§

fn set(&mut self, value: S) -> NothingOrError<E>

Set something to a value. For example, this could set a motor to a voltage. You should call this and not impl_set.
Source§

fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)

Begin following a Getter of the same type. For this to work, you must have update_following_data in your Updatable implementation.
Source§

fn stop_following(&mut self)

Stop following the Getter.
Source§

fn update_following_data(&mut self) -> NothingOrError<E>

Get a new value from the Getter we’re following, if there is one, and call set accordingly. You must add this to your Updatable implementation if you are following Getters. This is a current limitation of the Rust language. If specialization is ever stabilized, this will hopefully be done in a better way.
Source§

fn get_last_request(&self) -> Option<S>

Get the argument from the last time set was called.
Source§

impl Sub for Command

Source§

type Output = Command

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl SubAssign for Command

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl TryFrom<Quantity> for Command

Source§

type Error = ()

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

fn try_from(was: Quantity) -> Result<Self, ()>

Performs the conversion.
Source§

impl Copy for Command

Source§

impl StructuralPartialEq for Command

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.

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.