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
impl Command
Sourcepub const fn new(position_derivative: PositionDerivative, value: f32) -> Self
pub const fn new(position_derivative: PositionDerivative, value: f32) -> Self
Constructor for Command.
Sourcepub fn get_position(&self) -> Option<Quantity>
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.
Sourcepub fn get_velocity(&self) -> Option<Quantity>
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.
Sourcepub fn get_acceleration(&self) -> Quantity
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 AddAssign for Command
impl AddAssign for Command
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl DivAssign<f32> for Command
impl DivAssign<f32> for Command
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/= operation. Read moreSource§impl From<Command> for PositionDerivative
impl From<Command> for PositionDerivative
Source§impl MulAssign<f32> for Command
impl MulAssign<f32> for Command
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*= operation. Read moreSource§impl<G: Getter<State, E> + ?Sized, E: Copy + Debug> Settable<Command, E> for CommandPID<G, E>
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>
fn get_settable_data_ref(&self) -> &SettableData<Command, E>
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>
fn get_settable_data_mut(&mut self) -> &mut SettableData<Command, E>
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>
fn impl_set(&mut self, command: Command) -> NothingOrError<E>
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>
fn set(&mut self, value: S) -> NothingOrError<E>
impl_set.Source§fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
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)
fn stop_following(&mut self)
Getter.Source§fn update_following_data(&mut self) -> NothingOrError<E>
fn update_following_data(&mut self) -> NothingOrError<E>
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>
fn get_last_request(&self) -> Option<S>
set was called.Source§impl SubAssign for Command
impl SubAssign for Command
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more