You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
extr/pid.h

22 lines
434 B
C

#ifndef _PID_H_
#define _PID_H_
#include <stdint.h>
struct pid{
// Controller gains
float kP;
float kI;
float kD;
// State variables
float lastError;
float integral;
};
//float pid_step(volatile struct pid* controller, float dt, float error);
int16_t pid_step(volatile struct pid* controller, float dt, int16_t error);
void init_pid(volatile struct pid* controller, float p, float i, float d);
#endif