[][src]Struct pid::Pid

pub struct Pid<T: FloatCore> {
    pub kp: T,
    pub ki: T,
    pub kd: T,
    pub p_limit: T,
    pub i_limit: T,
    pub d_limit: T,
    // some fields omitted
}

Fields

kp: T

Proportional gain.

ki: T

Integral gain.

kd: T

Derivative gain.

p_limit: T

Limit of contribution of P term: (-p_limit <= P <= p_limit)

i_limit: T

Limit of contribution of I term (-i_limit <= I <= i_limit)

d_limit: T

Limit of contribution of D term (-d_limit <= D <= d_limit)

Methods

impl<T> Pid<T> where
    T: FloatCore
[src]

pub fn new(kp: T, ki: T, kd: T, p_limit: T, i_limit: T, d_limit: T) -> Self[src]

pub fn update_setpoint(&mut self, setpoint: T)[src]

Sets the desired setpoint.

Must be called before the first invocation to next_control_output().

pub fn get_setpoint(&mut self) -> Option<T>[src]

Returns the current setpoint.

pub fn reset_integral_term(&mut self)[src]

Resets the integral term back to zero. This may drastically change the control output.

pub fn next_control_output(&mut self, measurement: T) -> ControlOutput<T>[src]

Given a new measurement, calculates the next control output.

Panics

If a setpoint has not been set via update_setpoint().

Trait Implementations

impl<T: Debug + FloatCore> Debug for Pid<T>[src]

Auto Trait Implementations

impl<T> Send for Pid<T> where
    T: Send

impl<T> Sync for Pid<T> where
    T: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]