esp32-car/include/pid.h

31 lines
403 B
C
Raw Normal View History

2024-12-27 10:34:06 +08:00
#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