Project 2.5: Model Predictive Control

GitHub Repository






This project involves C++ program which simulate car drives around a virtual track using Model Predictive Control (MPC). Based on the draft and online course, I filled in and follow steps to complete this project. Although my result still has some issue, such as car drives on side line when sharply turn, this car can eventually drive by itself a lap without any accident.

The following steps are basic workflow in this project:

  1. Fitting a polynomial to the waypoints by using “polyfit”;

  2. Implementing MPC to set up parameters and constrains;

  3. Calculate tracking error by using “polyeval”;

  4. Estimate running steer angle and throttle value;

  5. Display the MPC predicted trajectory by separating “vars” values;

  6. Testing whole setup to record a video.