Trait pid_control::Controller [] [src]

pub trait Controller {
    fn update(&mut self, value: f64, delta_t: f64) -> f64;
    fn set_target(&mut self, target: f64);
    fn target(&self) -> f64;
    fn reset(&mut self);
}

A generic controller interface.

A controller is fed timestamped values and calculates an adjusted value based on previous readings.

Many controllers possess a set of adjustable parameters as well as a set of input-value dependant state variables.

Required Methods

fn update(&mut self, value: f64, delta_t: f64) -> f64

Record a measurement from the plant.

Records a new values. delta_t is the time since the last update in seconds.

fn set_target(&mut self, target: f64)

Adjust set target for the plant.

The controller will usually try to adjust its output (from update) in a way that results in the plant approaching target.

fn target(&self) -> f64

Retrieve target value.

fn reset(&mut self)

Reset internal state.

Resets the internal state of the controller; not to be confused with its parameters.

Implementors