pub struct LiftController<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
Controller state and configuration.
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> LiftController<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> LiftController<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>
Sourcepub fn new(
motor: LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>,
pid: Pid,
min_height_mm: f32,
max_height_mm: f32,
on_target_tolerance_mm: f32,
) -> Self
pub fn new( motor: LiftMotor<CS_P, CS_N, IN1_P, IN1_N, IN2_P, IN2_N, SLP_P, SLP_N, DIS_P, DIS_N>, pid: Pid, min_height_mm: f32, max_height_mm: f32, on_target_tolerance_mm: f32, ) -> Self
Create a new lift controller with PID gains and limits.
Sourcepub fn set_target_height_mm(&mut self, mm: f32)
pub fn set_target_height_mm(&mut self, mm: f32)
Set a new target height (mm), automatically clamped to limits.
Sourcepub fn on_target(&self) -> bool
pub fn on_target(&self) -> bool
Returns true if the lift is within tolerance of its commanded height.
Sourcepub fn step(&mut self, dt: f32)
pub fn step(&mut self, dt: f32)
Run one control step.
dt — time delta in seconds since the previous call, e.g. 0.01 for 10ms.
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 LiftController<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 LiftController<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 LiftController<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 LiftController<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 LiftController<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 LiftController<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