CarND-Controls-PID

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.

Parameter Tuning

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.

alt text

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.

alt text

This is what the final tuning looked like

alt text

Dependencies

There's an experimental patch for windows in this PR

Build Instructions

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