-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpid_controller.h
74 lines (59 loc) · 1.15 KB
/
pid_controller.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**********************************************
* Self-Driving Car Nano-degree - Udacity
* Created on: December 11, 2020
* Author: Mathilde Badoual
**********************************************/
#ifndef PID_CONTROLLER_H
#define PID_CONTROLLER_H
class PID {
public:
/**
* TODO: Create the PID class
**/
double Kp;
double Ki;
double Kd;
double output_lim_max;
double output_lim_min;
double cte;
double total_cte;
double prev_cte;
double delta_time;
/*
* Errors
*/
/*
* Coefficients
*/
/*
* Output limits
*/
/*
* Delta time
*/
/*
* Constructor
*/
PID();
/*
* Destructor.
*/
virtual ~PID();
/*
* Initialize PID.
*/
void Init(double Kp, double Ki, double Kd, double output_lim_max, double output_lim_min);
/*
* Update the PID error variables given cross track error.
*/
void UpdateError(double cte);
/*
* Calculate the total PID error.
*/
double TotalError();
/*
* Update the delta time.
*/
double UpdateDeltaTime(double new_delta_time);
};
#endif //PID_CONTROLLER_H