simple header only pid class ready to import as a source library in ROSMOD
sudo apt-get install python-catkin-tools
cd
mkdir catkin_ws #if a workspace does not already exist
cd catkin_ws
git clone https://github.com/rosmod/lib-pid.git src/lib-pid
cd ~/catkin_ws
catkin clean pid
cd src/lib-pid
git pull
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);
double max = pidObject.getOutputMax();
double min = pidObject.getOutputMin();
bool isSet = pidObject.outputIsLimited();
pidObject.delimitOutput();
// double deadzoneLower = xxx;
// double deadzoneUpper = xxx;
pidObject.setDeadzone(deadzoneLower, deadzoneUpper);
double upper = pidObject.getDeadzoneUpper();
double lower = pidObject.getDeadzoneLower();
bool isSet = pidObject.hasDeadzone();
pidObject.removeDeadzone();
- Copy the url of this repo (https://github.com/rosmod/lib-pid)
- 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
5 Optionally specify a branch to use in the branch attribute - 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