![]() |
RaidZeroLib
Coroutine robot framework for VEX V5
|
A PID controller from an error to an output, e.g. Pid<Angle, Voltage> for a turn. More...
#include <Pid.hpp>
Classes | |
| struct | Gains |
| struct | Config |
Public Types | |
| using | ProportionalGain = decltype(Output{} / Error{}) |
| using | IntegralGain = decltype(Output{} / (Error{} * Duration{})) |
| using | DerivativeGain = decltype(Output{} * Duration{} / Error{}) |
Public Member Functions | |
| Pid (Config config) | |
| Output | update (Error error, Duration dt) |
| The output for error, dt after the previous update. | |
| void | reset () |
| Forgets the accumulated integral and the previous error, e.g. before a new motion. | |
A PID controller from an error to an output, e.g. Pid<Angle, Voltage> for a turn.
The gains carry units, so au::volts(12.0) / au::degrees(90.0) is a valid proportional gain for Pid<Angle, Voltage> and a gain with the wrong units does not compile. The derivative acts on the error, and the first update after construction or reset() has no derivative term.
| using rz::Pid< Error, Output >::DerivativeGain = decltype(Output{} * Duration{} / Error{}) |
| using rz::Pid< Error, Output >::IntegralGain = decltype(Output{} / (Error{} * Duration{})) |
| using rz::Pid< Error, Output >::ProportionalGain = decltype(Output{} / Error{}) |
|
inline |
Forgets the accumulated integral and the previous error, e.g. before a new motion.
|
inlinenodiscard |
The output for error, dt after the previous update.