Skip to content

KMD2/CarND-PID-Control-Project

Repository files navigation

CarND-Controls-PID

Self-Driving Car Engineer Nanodegree Program


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

Editor Settings

We've purposefully kept editor configuration files out of this repo in order to keep it as simple and environment agnostic as possible. However, we recommend using the following settings:

  • indent using spaces
  • set tab width to 2 spaces (keeps the matrices in source code aligned)

Code Style

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

Project Instructions and Rubric

Note: regardless of the changes you make, your project must be buildable using cmake and make!

More information is only accessible by people who are already enrolled in Term 2 of CarND. If you are enrolled, see the project page for instructions and the project rubric.

Hints!

  • You don't have to follow this directory structure, but if you do, your work will span all of the .cpp files here. Keep an eye out for TODOs.

Reflection

The choice of the final hyperparameters (P, I, D coefficients) have been done through manual tuning as will be discussed below.

The PID controller consists of three terms:

1) Proportional Term

In the proportional term, the steering angle is proportional by a factor of (tau_p) to the Cross Track Error (CTE). To test the effect of this term, I set the value of it to (1) and the rest of the terms to zero (1,0,0). As expected the car was oscillating very fast (Overshoots) and so a lower value of K_p would lower the oscillation of the car. After trying many values, I ended up choosing a small value (0.09).

2) Differential Term

In the differential term, the steering angle is proportional to the temporal derivative of the CTE (i.e. the difference between two congestive CTE over time). To test the effect of this term, I set the value of it to (1) and the rest of the components to zero (0,0,1). As expected, the change in the steering angle was very minimal (as if the car was going in a straight line). This term helps very much in reducing the error and smoothing the steering. Hence, I choose a relatively high value - in combination with the other two terms - that was just sufficient in the cases of sharp turns (very high values negatively affect the performance around sharp turns). I used a value of (2.1).

3) Integral Term

In Integral term, the steering is proportional to the integral (sum) of all previously encountered CTE over time. This term helps in deriving the error down to zero (Overcoming the systematic bais). To test the effect of the integral term, I set the value of it to (1) and the rest of the components to zero (0,1,0). As expected the car was oscillating very fast. For this term, it is wise to choose a relatively small number since it accumulates with time. I choose a very low value (0.001) but it didn't perform well in sharp turns, increasing the number to (0.004) solved the problem.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published