##What is a PID Controller
PID controller is a control loop feedback controller. This type of controller is used widely among different control problems.
PID controller consists of three components named as Proportional, Integrative, Derivative.
Proportional error is proportional to systems overall error. Derivative error is propportional to how fast the error increasing or decreasing. Integrative error is proportional to cumulative error that depends to system run before.
Three errors are implemented by using the following code block:
Each kind of error types are used to provide a smooth system act. Not all the systems need to have all the components simple P controllers or PD controllers may be implemented as well.
##PID Controller Implementation
In the project source code we have PID.cpp and PID.h files. These files define the PID class which implements a simple PID controller.
In UpdateError method, three different errors are defined. In TotalError method, total error of the system is calculated using three types of error. This result is given as a steering value to the simulator.
##Tuning PID Parameters
I have chosen to tune PID parameters by a manual try and error way. Since P error affects the overall system a lot, I first start to tune P value by setting I and D values to 0. In other words, I started by a simple P controller as a first step. I started to tune D parameter as the P controller performs well and finally I parameter is tuned.
Below you can find different videos related to different steps of tuning: