Self-Driving Car Engineer Nanodegree Program
This project uses PID control to steer a vehicle around a simulated test track. As a summary, The P (Proportional) term is proportional to the distance the vehicle is from the reference path, otherwise known as cross track error or CTE. The I (Integral) term is the sum of all previous deviations from reference and is used to remove persistent biases which may be caused by, for example, bad vehicle alignment. The D (Derivative) term is used to dampen oscillations and make the vehicle turn more smoothly.
Manual parameter tuning was used for this project. Modifying the simualtor to simply output CTE and run faster than real time would enable more efficient tuning methods such as gradient descent.
The P term was initialized to a low value (0.01) and adjusted up until the car did not understeer as seen below. 0.3 worked well for this.
The I term was found to be unnecessary as there were no persistent biases in this controlled simulation.
The D term was incremented up to 7.0 where oscillations (shown below) were sufficiently damped as to not cause discomfort.
This is what the final tuning looked like
- cmake >= 3.5
- All OSes: click here for installation instructions
- make >= 4.1
- 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.
There's 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
.