diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-09 00:53:10 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-09 00:53:10 -0600 |
commit | 3f0be672f9c5a07a98be0dc703b95f1bbe73f33e (patch) | |
tree | aeb7776878e3460f7ba1f33cf2c0d195eb45f2c5 /src/PID.h | |
parent | b92adb44b618db0272819cb77e5727441c566838 (diff) |
Mouse control working
Diffstat (limited to 'src/PID.h')
-rw-r--r-- | src/PID.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/PID.h b/src/PID.h new file mode 100644 index 0000000..649a113 --- /dev/null +++ b/src/PID.h @@ -0,0 +1,41 @@ +#include "gameCommon.h" + +#ifndef PID_H +#define PID_H + +// Hehehehe! PID CONTROLLER INDEED! + +typedef struct PIDConfig { + float kP; + float kI; + float kD; + + bool doClamp; + float min; + float max; +} PIDConfig; + +typedef struct PID { + float p; + float i; + float d; + + float kP; + float kI; + float kD; + + bool doClamp; + float min; + float max; + + float error; + float pastError; + + float output; +} PID; + +PID createPID(PIDConfig config); +float runPID(float setpoint, float processValue, PID * pid); +void resetPID(PID * pid); + +#endif |