English / 简体中文
A collection of PID implementations.
- Unified call interface, no need to worry about specific PID implementations
- Static memory allocation, no dependencies, suitable for microcontrollers
- Easy to extend, supports running multiple PID controllers simultaneously
- Includes analysis, testing, and simulation tools (TODO)
- Comes with documentation and examples
- default
- integral decay
- integral clamp
- integral separation
- integral sliding window
see more in examples
#include "pid/pid.h"
#include <stdbool.h>
void unknown_control(float thrust);
float unknown_sensor();
int main() {
struct Pid pid = pid_new(1, 0, 0);
float target = 0;
while (true) {
float actual = unknown_sensor();
float thrust = pid_update(&pid, target, actual, 0.1);
unknown_control(thrust);
}
}
It is recommended to download pid directly from GitHub Release
(remove the example
test
simulate
folders) and unzip it to the project directory,
add the code files under pid
to the project and you can use it.
You can also use git clone
to the project directory.
$ git clone https://github.com/xj63/PID -o pid # clone to local
Welcome contributions to add new features and improve this PID controller implementation!