Struct pid::ControlOutput
source · pub struct ControlOutput<T: FloatCore> {
pub p: T,
pub i: T,
pub d: T,
pub output: T,
}
Expand description
Output of controller iterations with weights
Example
This structure is simple to use and features three weights: p, i, and d. These can be used to figure out how much each term from Pid contributed to the final output value which should be taken as the final controller output for this iteration:
use pid::{Pid, ControlOutput};
// Setup controller
let mut pid = Pid::new(15.0, 100.0);
pid.p(10.0, 100.0).i(1.0, 100.0).d(2.0, 100.0);
// Input an example value and get a report for an output iteration
let output = pid.next_control_output(26.2456);
println!("P: {}\nI: {}\nD: {}\nFinal Output: {}", output.p, output.i, output.d, output.output);
Fields§
§p: T
Contribution of the P term to the output.
i: T
Contribution of the I term to the output.
This integral term is equal to sum[error(t) * ki(t)] (for all t)
d: T
Contribution of the D term to the output.
output: T
Output of the PID controller.
Trait Implementations§
source§impl<T: PartialEq + FloatCore> PartialEq<ControlOutput<T>> for ControlOutput<T>
impl<T: PartialEq + FloatCore> PartialEq<ControlOutput<T>> for ControlOutput<T>
source§fn eq(&self, other: &ControlOutput<T>) -> bool
fn eq(&self, other: &ControlOutput<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.