Struct 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: Debug + FloatCore> Debug for ControlOutput<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq + FloatCore> PartialEq for ControlOutput<T>

Source§

fn eq(&self, other: &ControlOutput<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq + FloatCore> Eq for ControlOutput<T>

Source§

impl<T: FloatCore> StructuralPartialEq for ControlOutput<T>

Auto Trait Implementations§

§

impl<T> Freeze for ControlOutput<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for ControlOutput<T>
where T: RefUnwindSafe,

§

impl<T> Send for ControlOutput<T>
where T: Send,

§

impl<T> Sync for ControlOutput<T>
where T: Sync,

§

impl<T> Unpin for ControlOutput<T>
where T: Unpin,

§

impl<T> UnwindSafe for ControlOutput<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.