pub struct PID {Show 17 fields
pub reset_filter: bool,
pub target: f32,
pub error: f32,
pub derivative: f32,
pub dt: f32,
pub info: Info,
pub slew_limiter: SlewLimiter<2>,
pub slew_limit_scale: f32,
pub integrator: f32,
pub kp: f32,
pub ki: f32,
pub kd: f32,
pub ki_max: f32,
pub kff: f32,
pub filter_t_hz: f32,
pub filter_e_hz: f32,
pub filter_d_hz: f32,
}
Fields§
§reset_filter: bool
§target: f32
§error: f32
§derivative: f32
§dt: f32
§info: Info
§slew_limiter: SlewLimiter<2>
§slew_limit_scale: f32
§integrator: f32
§kp: f32
§ki: f32
§kd: f32
§ki_max: f32
§kff: f32
§filter_t_hz: f32
§filter_e_hz: f32
§filter_d_hz: f32
Implementations§
Source§impl PID
impl PID
pub fn new( initial_p: f32, initial_i: f32, initial_d: f32, initial_ff: f32, initial_imax: f32, initial_filt_T_hz: f32, initial_filt_E_hz: f32, initial_filt_D_hz: f32, dt: f32, ) -> Self
pub fn with_slew_rate( initial_p: f32, initial_i: f32, initial_d: f32, initial_ff: f32, initial_imax: f32, initial_filt_T_hz: f32, initial_filt_E_hz: f32, initial_filt_D_hz: f32, dt: f32, initial_srmax: f32, initial_srtau: f32, ) -> Self
Source§impl PID
impl PID
pub fn target_filter_alpha(&self) -> f32
pub fn error_filter_alpha(&self) -> f32
pub fn derivative_filter_alpha(&self) -> f32
pub fn feed_forward(&self) -> f32
Sourcepub fn update_integral(&mut self, limit: bool)
pub fn update_integral(&mut self, limit: bool)
Update the integral part of this PID. If the limit flag is set the integral is only allowed to shrink.
Sourcepub fn update(
&mut self,
target: f32,
measurement: f32,
limit: bool,
now_ms: u32,
) -> f32
pub fn update( &mut self, target: f32, measurement: f32, limit: bool, now_ms: u32, ) -> f32
Update target and measured inputs to the PID controller and calculate output. Target and error are filtered, then derivative is calculated and filtered, then the integral is then updated based on the setting of the limit flag
Auto Trait Implementations§
impl Freeze for PID
impl RefUnwindSafe for PID
impl Send for PID
impl Sync for PID
impl Unpin for PID
impl UnwindSafe for PID
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
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.