pub struct PidState {
pub integral: i32,
pub derivative: i32,
/* private fields */
}Expand description
C-layout PID memory, with reset marking the next measurement as the derivative origin.
Fields§
§integral: i32Current bounded integral.
derivative: i32Current bounded filtered derivative on measurement.
Implementations§
Source§impl PidState
impl PidState
Sourcepub fn step(
&mut self,
coefficients: &Coefficients,
cycle: u32,
reference: i32,
position: i32,
) -> Result<Command, InvalidCoefficients>
pub fn step( &mut self, coefficients: &Coefficients, cycle: u32, reference: i32, position: i32, ) -> Result<Command, InvalidCoefficients>
Update a conditional-integration PID with derivative on measurement.
The prior integral is used to detect output saturation. If saturation and error have the same direction, retain that integral; otherwise accept the proposed integral before computing the command. First-sample derivative is zero. Invalid coefficients leave state unchanged. Gains remain stable until reset.
Trait Implementations§
impl Copy for PidState
impl Eq for PidState
impl StructuralPartialEq for PidState
Auto Trait Implementations§
impl Freeze for PidState
impl RefUnwindSafe for PidState
impl Send for PidState
impl Sync for PidState
impl Unpin for PidState
impl UnsafeUnpin for PidState
impl UnwindSafe for PidState
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