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§
Sourcefn update(&mut self, value: f64, delta_t: f64) -> f64
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.
Sourcefn set_target(&mut self, target: f64)
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
.