Result

CarND-Controls-PID

Self-Driving Car Engineer Nanodegree Program


Reflection

Effect of the P, I, D Components.

  • Proportional (P): Makes the car steer towards the CTE. It is achieved by multiplying the CTE by P values. It will never reach the CTE but will oscillate around it, resulting in an unsecure behaviour. If the value is too high, we would observe the car swerve around. That's the reason to use I and D temrs.

  • Integral (I): Briefly, compensates the systematic bias which prevents the P-D controller from reaching the center line. This is achieved acumulating the value of the surface between the car position and the CTE over time, and multipying this value by the I coefficient.

  • Differential (D): This part of the controller corrects for the error from the previous state. This way the Proportional controller can have a lower value and the remaining correction is done by the Derivative controller. This leads to smoother steering.

Final hyperparameters.

For Parameter Tuning, I used the twiddle algorithm. Since the twiddle algorithm recursively finds the parameters, it takes a long time to converge. Instead I switched to manually tuning for getting a closer result to make the process faster.

After figuring out the broad range of the values they were narrowed down to maximize the smoothness of the drive. Afterwards I tuned the parameters for the speed controller using a similar approach.

Final Steer Final Throttle
P 0.06 0.5
I 0.00174 0.002
D 1.8 10

Result of Each Compenent

P Components PD Components PID Components
P PD PID

Dependencies

Fellow students have put together a guide to Windows set-up for the project here if the environment you have set up for the Sensor Fusion projects does not work for this project. There's also an experimental patch for windows in this PR.

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run it: ./pid.

Tips for setting up your environment can be found here

Code Style

Please (do your best to) stick to Google's C++ style guide.