-
Notifications
You must be signed in to change notification settings - Fork 69
/
MiniPID.h
58 lines (48 loc) · 1.06 KB
/
MiniPID.h
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
48
49
50
51
52
53
54
55
56
57
58
#ifndef MINIPID_H
#define MINIPID_H
class MiniPID{
public:
MiniPID(double, double, double);
MiniPID(double, double, double, double);
void setP(double);
void setI(double);
void setD(double);
void setF(double);
void setPID(double, double, double);
void setPID(double, double, double, double);
void setMaxIOutput(double);
void setOutputLimits(double);
void setOutputLimits(double,double);
void setDirection(bool);
void setSetpoint(double);
void reset();
void setOutputRampRate(double);
void setSetpointRange(double);
void setOutputFilter(double);
double getOutput();
double getOutput(double);
double getOutput(double, double);
private:
double clamp(double, double, double);
bool bounded(double, double, double);
void checkSigns();
void init();
double P;
double I;
double D;
double F;
double maxIOutput;
double maxError;
double errorSum;
double maxOutput;
double minOutput;
double setpoint;
double lastActual;
bool firstRun;
bool reversed;
double outputRampRate;
double lastOutput;
double outputFilter;
double setpointRange;
};
#endif