Trait Controller

Source
pub trait Controller {
    // Required methods
    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);
}
Expand description

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§

Source

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.

Source

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.

Source

fn target(&self) -> f64

Retrieve target value.

Source

fn reset(&mut self)

Reset internal state.

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

Implementors§