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§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.