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 revolutioncounts_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>
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>
Sourcepub 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
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.
Sourcepub fn target_ticks_for_height(&self, mm: f32) -> i32
pub fn target_ticks_for_height(&self, mm: f32) -> i32
Compute the target tick position for an absolute height command.
Sourcepub fn delta_ticks_for_height(&self, delta_mm: f32) -> i32
pub fn delta_ticks_for_height(&self, delta_mm: f32) -> i32
Compute a relative tick movement for a delta height.
Sourcepub fn move_by_mm(&mut self, delta_mm: f32) -> i32
pub fn move_by_mm(&mut self, delta_mm: f32) -> i32
Move by a relative number of millimeters.
Sourcepub fn move_by_revs(&mut self, revs: f32) -> i32
pub fn move_by_revs(&mut self, revs: f32) -> i32
Move by a relative number of revolutions.
Sourcepub fn go_to_height_mm(&mut self, mm: f32) -> i32
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.
Sourcepub 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>
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.
Sourcepub fn apply_pid_output(&mut self, u: f32)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more