LiftMotor

Struct LiftMotor 

Source
pub struct LiftMotor<const CS_P: char, const CS_N: u8, const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, const SLP_P: char, const SLP_N: u8, const DIS_P: char, const DIS_N: u8> { /* private fields */ }
Expand description

Lift motor abstraction layered on top of a SpiMotor.

Geometry parameters:

  • mm_per_rev: mechanical displacement per output shaft revolution
  • counts_per_rev: inherited automatically from underlying motor

Implementations§

Source§

impl<const CS_P: char, const CS_N: u8, const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, const SLP_P: char, const SLP_N: u8, const DIS_P: char, const DIS_N: u8> LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>

Source

pub fn new( motor: Fit0185<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>, mm_per_rev: f32, ) -> Self

Create a new LiftMotor wrapper.

mm_per_rev — how many millimeters the actuator moves per full revolution.

Source

pub fn height_mm(&self) -> f32

Convert encoder ticks to millimeters of extension.

Source

pub fn target_ticks_for_height(&self, mm: f32) -> i32

Compute the target tick position for an absolute height command.

Source

pub fn delta_ticks_for_height(&self, delta_mm: f32) -> i32

Compute a relative tick movement for a delta height.

Source

pub fn move_by_mm(&mut self, delta_mm: f32) -> i32

Move by a relative number of millimeters.

Source

pub fn move_by_revs(&mut self, revs: f32) -> i32

Move by a relative number of revolutions.

Source

pub fn go_to_height_mm(&mut self, mm: f32) -> i32

Command the lift to go to a specific height (mm), returning a tick target.

Source

pub fn zero(&mut self)

Reset encoder reference (zero height).

Source

pub fn inner_motor( &mut self, ) -> &mut Fit0185<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>

Expose the underlying SpiMotor.

Source

pub fn apply_pid_output(&mut self, u: f32)

Apply PID output to the underlying motor.

Auto Trait Implementations§

§

impl<const CS_P: char, const CS_N: u8, const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, const SLP_P: char, const SLP_N: u8, const DIS_P: char, const DIS_N: u8> Freeze for LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>

§

impl<const CS_P: char, const CS_N: u8, const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, const SLP_P: char, const SLP_N: u8, const DIS_P: char, const DIS_N: u8> RefUnwindSafe for LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>

§

impl<const CS_P: char, const CS_N: u8, const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, const SLP_P: char, const SLP_N: u8, const DIS_P: char, const DIS_N: u8> Send for LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>

§

impl<const CS_P: char, const CS_N: u8, const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, const SLP_P: char, const SLP_N: u8, const DIS_P: char, const DIS_N: u8> !Sync for LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>

§

impl<const CS_P: char, const CS_N: u8, const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, const SLP_P: char, const SLP_N: u8, const DIS_P: char, const DIS_N: u8> Unpin for LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>

§

impl<const CS_P: char, const CS_N: u8, const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, const SLP_P: char, const SLP_N: u8, const DIS_P: char, const DIS_N: u8> UnwindSafe for LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>

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> 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, 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.