blob: 03eadf39bd01fb6440c10e8e881ff91533d83167 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "gameCommon.h"
#ifndef PID_H
#define PID_H
// Hehehehe! PID CONTROLLER INDEED!
typedef struct PIDConfig {
float kP;
float kI;
float kD;
// Angles are fucking weird.
bool angleMode;
bool doClamp;
float min;
float max;
} PIDConfig;
typedef struct PID {
float p;
float i;
float d;
float kP;
float kI;
float kD;
bool angleMode;
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);
// Angle shit.
float angleDis(float a, float b);
#endif
|