Expand description
PID (Proportional-Integral-Derivative) controller implementation.
A PID controller is a control loop feedback mechanism used in robotics to maintain a desired setpoint by continuously calculating and applying a correction based on the error between the desired and actual values.
§PID Components
- Proportional (P): Response to current error
- Integral (I): Response to accumulated error over time
- Derivative (D): Response to rate of change of error
§Example
// Create a PID controller with tuned constants
let mut pid = Pid::new(1.0, 0.01, 0.1);
// In your control loop:
let setpoint = 100.0;
let current_value = 95.0;
let error = setpoint - current_value;
pid.calculate(error);
// Use the PID output to adjust your systemStructs§
- Pid
- A PID controller for closed-loop control systems.