A simple platform-independent C++ PID controller class
- No dependencies on Arduino or any other MCU framework
- Minimal API: fields are public for simple access
- The core logic is all in the
update
function. It has basic provisions for reducing derivative kick and integrator windup. - No manual/auto selection (always on; switch externally if needed.)
- This is a conventional reverse-acting loop. If a direct-acting loop is needed, negate the output (possibly with an offset).
This draws from the Arduino library by Brett Beauregard. See also the the author's accompanying explanations.
Fixing PID part 1, part 2, and part 3 by Vance VanDoren
PID Without a PhD by Tim Wescott
Feedback Systems textbook by K. Astrom and R. Murray