esp32-car/include/pid.h

31 lines
403 B
C++

#ifndef __PID_H__
#define __PID_H__
#include "consts.h"
struct PIDConfig
{
float Kp;
float Ki;
float Kd;
};
struct PID
{
float error;
float integral;
float derivative;
float last_error;
};
class PIDController
{
public:
static PIDConfig pidConfig;
static PID pid;
static void setConfig(float Kp, float Ki, float Kd);
static float update(float target, float current);
};
#endif