simple pid class ready to import as a source library in ROSMOD
- In this github repo navigate to releases, right click on
pid.zip
(not the source code zip!) and select `Copy link address' - In a rosmod project, drag in a new source library to the software model
- Paste the link in the url attribute
- Name the source library
pid
- Drag the library into the
set editor
of any component that uses it - In the forwards section of the component add
#include "pid/pid.h
PID pidObject();
PID pidObject(Kp, Ki, Kd, 0, 0, i_max, i_min);
// double goal = XXX;
pidObject.setPoint(goal);
// double currentValue = XXX;
double output = pidObject.update(currentValue);
// double outputMin = XXX;
// double outputMax = XXX;
pidObject.limitOutput(outputMin, outputMax);