pub struct PressureControl { /* private fields */ }Expand description
A closed-loop PID pressure/force controller for Profile Position (PP) axes.
Implementations§
Source§impl PressureControl
impl PressureControl
Sourcepub fn start(&mut self, target_load: f64, max_load: f64)
pub fn start(&mut self, target_load: f64, max_load: f64)
Engage the loop. Latches target_load and the safety ceiling
max_load; clears PID state. The next tick() seeds
commanded_position from the axis’s current position.
max_load is checked against |current_load| every tick; exceeding
it transitions to Error and halts the axis. Pass f64::INFINITY
if you genuinely want no limit (not recommended).
Sourcepub fn stop(&mut self, axis: &mut impl AxisHandle)
pub fn stop(&mut self, axis: &mut impl AxisHandle)
Halt the axis and transition toward Idle. Safe to call any time; a no-op when already Idle or Halted.
Sourcepub fn set_target(&mut self, target_load: f64)
pub fn set_target(&mut self, target_load: f64)
Change the target load without resetting the loop. Useful for setpoint ramps during a test.
Sourcepub fn set_max_load(&mut self, max_load: f64)
pub fn set_max_load(&mut self, max_load: f64)
Change the max-load safety limit without resetting the loop.
Sourcepub fn error_message(&self) -> String
pub fn error_message(&self) -> String
Description of the most recent error.
Sourcepub fn is_in_tolerance(&self) -> bool
pub fn is_in_tolerance(&self) -> bool
True once the load has been within config.tolerance of
target_load for at least config.settling_time seconds.
Sourcepub fn filtered_load(&self) -> f64
pub fn filtered_load(&self) -> f64
Most recent filtered load reading. Updated every tick().
Sourcepub fn commanded_position(&self) -> f64
pub fn commanded_position(&self) -> f64
Current internal commanded position (user units). Updated every
tick() by adding the clamped PID step.
Sourcepub fn pid_error(&self) -> f64
pub fn pid_error(&self) -> f64
Most recent PID error: target_load − filtered_load. Signed; sign
is NOT inverted by config.invert_direction.
Sourcepub fn tick(
&mut self,
axis: &mut impl AxisHandle,
current_load: f64,
config: &PressureControlConfig,
dt: f64,
)
pub fn tick( &mut self, axis: &mut impl AxisHandle, current_load: f64, config: &PressureControlConfig, dt: f64, )
Advance the loop by one scan. No-op when Idle.
Trait Implementations§
Source§impl Clone for PressureControl
impl Clone for PressureControl
Source§fn clone(&self) -> PressureControl
fn clone(&self) -> PressureControl
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more