-
Notifications
You must be signed in to change notification settings - Fork 1
/
pid_controller.h
70 lines (54 loc) · 1.09 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
/**********************************************
* 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
**/
/*
* Errors
*/
double p_error, i_error, d_error;
/*
* Coefficients
*/
double Kp, Ki, Kd;
/*
* Output limits
*/
double min_lim, max_lim;
/*
* Delta time
*/
double 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