Skip to content

xj63/PID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English / 简体中文

PID

Docs License Repo Stars Language Last Commit GitHub Release

👋 Introduction

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

🚀 Features

  • default
  • integral decay
  • integral clamp
  • integral separation
  • integral sliding window

📖 Example

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);
  }
}

📦 Add to project

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

Contributing

Welcome contributions to add new features and improve this PID controller implementation!

Star History

Star History Chart