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§
impl<T: Eq + FloatCore> Eq for ControlOutput<T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more