Enum AxisState

Source
#[repr(u8)]
pub enum AxisState { Undefined = 0, Idle = 1, StartupSequence = 2, FullCalibrationSequence = 3, MotorCalibration = 4, SensorlessControl = 5, EncoderIndexSearch = 6, EncoderOffsetCalibration = 7, ClosedLoopControl = 8, }
Expand description

§State Machine

From the official docs:

The current state of an axis is indicated by <axis>.current_state. The user can request a new state by assigning a new value to <axis>.requested_state. The default state after startup is Idle.

  1. Idle
  2. StartupSequence
  3. FullCalibrationSequence
  4. MotorCalibration
  5. SensorlessControl
  6. EncoderIndexSearch
  7. EncoderOffsetCalibration
  8. ClosedLoopControl

Variants§

§

Undefined = 0

Used for

§

Idle = 1

Disable motor PWM and do nothing

§

StartupSequence = 2

Run the startup procedure.

§

FullCalibrationSequence = 3

Run motor calibration and then encoder offset calibration (or encoder index search if <axis>.encoder.config.use_index is true).

§

MotorCalibration = 4

Measure phase resistance and phase inductance of the motor.

To store the results set <axis>.motor.config.pre_calibrated to true and save the configuration. After that you don’t have to run the motor calibration on the next start up. This modifies the variables <axis>.motor.config.phase_resistance and <axis>.motor.config.phase_inductance.

§

SensorlessControl = 5

Run sensorless control.

The motor must be calibrated (<axis>.motor.is_calibrated). <axis>.controller.control_mode must be true.

§

EncoderIndexSearch = 6

Turn the motor in one direction until the encoder index is traversed.

This state can only be entered if <axis>.encoder.config.use_index is true.

§

EncoderOffsetCalibration = 7

Turn the motor in one direction for a few seconds and then back to measure the offset between the encoder position and the electrical phase.

Can only be entered if the motor is calibrated (<axis>.motor.is_calibrated). A successful encoder calibration will make the <axis>.encoder.is_ready go to true.

§

ClosedLoopControl = 8

Run closed loop control.

The action depends on the control mode. Can only be entered if the motor is calibrated (<axis>.motor.is_calibrated) and the encoder is ready (<axis>.encoder.is_ready).

Trait Implementations§

Source§

impl Clone for AxisState

Source§

fn clone(&self) -> AxisState

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 AxisState

Source§

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

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

impl Ord for AxisState

Source§

fn cmp(&self, other: &AxisState) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for AxisState

Source§

fn eq(&self, other: &AxisState) -> 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 PartialOrd for AxisState

Source§

fn partial_cmp(&self, other: &AxisState) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for AxisState

Source§

impl Eq for AxisState

Source§

impl StructuralPartialEq for AxisState

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.