Self-Driving Car Engineer Nanodegree Program
- cmake >= 3.5
- All OSes: click here for installation instructions
- make >= 4.1(mac, linux), 3.81(Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- Windows: Click here for installation instructions
- gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - [install Xcode command line tools]((https://developer.apple.com/xcode/features/)
- Windows: recommend using MinGW
- uWebSockets
- Run either
./install-mac.sh
or./install-ubuntu.sh
. - If you install from source, checkout to commit
e94b6e1
, i.e.Some function signatures have changed in v0.14.x. See this PR for more details.git clone https://github.com/uWebSockets/uWebSockets cd uWebSockets git checkout e94b6e1
- Run either
- Simulator. You can download these from the project intro page in the classroom.
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.
- Clone this repo.
- Make a build directory:
mkdir build && cd build
- Compile:
cmake .. && make
- Run it:
./pid
.
Tips for setting up your environment can be found here
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)
Please (do your best to) stick to Google's C++ style guide.
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.
- 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.
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:
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).
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).
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.