pub struct PIDController { /* private fields */ }Expand description
PID controller
Implementations§
Source§impl PIDController
impl PIDController
Sourcepub fn new(kp: f64, ki: f64, kd: f64, sample_time: f64) -> Self
pub fn new(kp: f64, ki: f64, kd: f64, sample_time: f64) -> Self
Create a new PID controller
§Arguments
kp- Proportional gainki- Integral gainkd- Derivative gainsample_time- Sample time in seconds
Sourcepub fn set_output_limits(&mut self, min: f64, max: f64) -> ControlResult<()>
pub fn set_output_limits(&mut self, min: f64, max: f64) -> ControlResult<()>
Set output limits
Sourcepub fn set_integral_limits(&mut self, min: f64, max: f64) -> ControlResult<()>
pub fn set_integral_limits(&mut self, min: f64, max: f64) -> ControlResult<()>
Set integral limits
Sourcepub fn set_anti_windup(&mut self, method: AntiWindup)
pub fn set_anti_windup(&mut self, method: AntiWindup)
Set anti-windup method
Sourcepub fn set_derivative_filter(&mut self, alpha: f64) -> ControlResult<()>
pub fn set_derivative_filter(&mut self, alpha: f64) -> ControlResult<()>
Set derivative filter coefficient (0-1)
Higher values provide more filtering but slower response
Sourcepub fn tune_ziegler_nichols(
&mut self,
ultimate_gain: f64,
ultimate_period: f64,
) -> ControlResult<()>
pub fn tune_ziegler_nichols( &mut self, ultimate_gain: f64, ultimate_period: f64, ) -> ControlResult<()>
Sourcepub fn tune_cohen_coon(
&mut self,
process_gain: f64,
time_constant: f64,
dead_time: f64,
) -> ControlResult<()>
pub fn tune_cohen_coon( &mut self, process_gain: f64, time_constant: f64, dead_time: f64, ) -> ControlResult<()>
Sourcepub fn to_transfer_function(&self) -> ControlResult<TransferFunction>
pub fn to_transfer_function(&self) -> ControlResult<TransferFunction>
Convert PID to transfer function representation
C(s) = Kp + Ki/s + Kd*s
Sourcepub fn simulate_step_response(
&mut self,
plant_tf: &TransferFunction,
setpoint: f64,
time_span: (f64, f64),
num_points: usize,
) -> ControlResult<(Vec<f64>, Vec<f64>, Vec<f64>)>
pub fn simulate_step_response( &mut self, plant_tf: &TransferFunction, setpoint: f64, time_span: (f64, f64), num_points: usize, ) -> ControlResult<(Vec<f64>, Vec<f64>, Vec<f64>)>
Simulate step response of closed-loop system
§Arguments
plant_tf- Plant transfer function G(s)setpoint- Desired setpointtime_span- (start_time, end_time)num_points- Number of simulation points
Trait Implementations§
Source§impl Clone for PIDController
impl Clone for PIDController
Source§fn clone(&self) -> PIDController
fn clone(&self) -> PIDController
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PIDController
impl RefUnwindSafe for PIDController
impl Send for PIDController
impl Sync for PIDController
impl Unpin for PIDController
impl UnsafeUnpin for PIDController
impl UnwindSafe for PIDController
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.