/CarND-PID-Control-Project

PID Controller Project

Primary LanguageC++MIT LicenseMIT

PID Controller Project

This project implements a PID controller in C++ to maneuver the vehicle around the track!

The simulator will provide you the cross track error (CTE) and the velocity (mph) in order to compute the appropriate steering angle.

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.

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

PID Controllers

Proportional Control

The proportional control (P) tends to steer the car towards the center line of the road, aiming to the cross-track error. If you try to use this control in isolation, the car will constantly overshoot the center line, in a zig-zag pattern.

Integral Control

The integral control (I) helps to control systematic bias in the controllers. If used along the car will take a circular trajectory. I couldn't observe a bias in the controllers of the simulator, thus the integral controller was not added to the hyper-parameters.

Derivative Control

The derivative control (D) smooth the proportional controller transition to the center line, thus avoiding overshooting.

Hyper-parameters Tuning

The parameters were chosen manually, the tuning strategy below:

First I decided to tune the proportional controller since this control tends to overshoot the center line, I tried to pick a value where the oscillation amplitude was small.

Secondly, I tuned the derivative control, since this smooth the proportional control tendency to overshoot.

Third, noticed was not necessary to tune the integral controller, since couldn't observe any bias in the simulator controllers.

Finally, the parameters I chose were:

Kp = 0.25
Ki = 0
Kd = 4

Video

Here's a link to my video result