pub struct RobustPid<T: Float> { /* private fields */ }Expand description
Advanced PID controller for critical systems
Implementations§
Source§impl<T: Float> RobustPid<T>
impl<T: Float> RobustPid<T>
Sourcepub fn new(config: PidConfig<T>) -> Self
pub fn new(config: PidConfig<T>) -> Self
Create a new PID controller with the given configuration
Sourcepub fn with_gains(kp: T, ki: T, kd: T) -> Self
pub fn with_gains(kp: T, ki: T, kd: T) -> Self
Create a PID controller with default settings
Sourcepub fn set_setpoint(&mut self, setpoint: T)
pub fn set_setpoint(&mut self, setpoint: T)
Set the target setpoint
Sourcepub fn update_config(&mut self, config: PidConfig<T>)
pub fn update_config(&mut self, config: PidConfig<T>)
Update configuration (allows online tuning)
Sourcepub fn update(&mut self, measurement: T, dt: T) -> ControlOutput<T>
pub fn update(&mut self, measurement: T, dt: T) -> ControlOutput<T>
Compute control output with variable time step
This method uses setpoint tracking mode: error = setpoint - measurement
Sourcepub fn update_from_error(&mut self, error: T, dt: T) -> ControlOutput<T>
pub fn update_from_error(&mut self, error: T, dt: T) -> ControlOutput<T>
Compute control output directly from error signal
Use this when you already have the error calculated externally. Positive error means the system needs to increase output. Negative error means the system needs to decrease output.
§Example
ⓘ
// External error source (e.g., from sensor fusion, observer, etc.)
let error = calculate_tracking_error(); // Could be +/- value
let output = pid.update_from_error(error, dt);
// Controller will drive error toward zeroSourcepub fn reset_integral(&mut self)
pub fn reset_integral(&mut self)
Reset only integral term (for integral windup recovery)
Sourcepub fn preload_integral(&mut self, value: T)
pub fn preload_integral(&mut self, value: T)
Manual integral preload (for bumpless transfer)
Sourcepub fn get_integral_term(&self) -> T
pub fn get_integral_term(&self) -> T
Get current integral term value
Sourcepub fn diagnostics(&self) -> PidDiagnostics<T>
pub fn diagnostics(&self) -> PidDiagnostics<T>
Get diagnostic information
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RobustPid<T>where
T: Freeze,
impl<T> RefUnwindSafe for RobustPid<T>where
T: RefUnwindSafe,
impl<T> Send for RobustPid<T>where
T: Send,
impl<T> Sync for RobustPid<T>where
T: Sync,
impl<T> Unpin for RobustPid<T>where
T: Unpin,
impl<T> UnsafeUnpin for RobustPid<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for RobustPid<T>where
T: UnwindSafe,
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