In this project, a model predictive controller (MPC) is built for assisted lane keeping. This is an extension to the PID controller which looked at the similar problem, but it address the drawbacks of the PID controller. The controller minimizes the cross track error, which is the value that the vehicle is off from the center of the road and the heading orientation error which helps the vehicle to be centered in the lane. A model predictive controller (MPC) controls the process variable while satisfying a set of constraints. The model predictive controller looks at the problem as an optimization problem. It selects the trajectory with minimum cost by simulating different actuation commands. It optimizes a finite time horizon by only implementing the current timeslot and optimizes again in the next time step. MPC can anticipate future events and can take appropriate control action which make it different from a PID controller. Therefore, it is sometimes called as a receding horizon control. The GIF above shows the MPC algorithm in action.
git clone https://github.com/sumukhpatil/Model-Predictive-Controller.git
cd Model-Predictive-Controller
mkdir build && cd build
cmake ..
make
./mpc
- cmake >= 3.5
- All OSes: click here for installation instructions
- make >= 4.1 (Linux, Mac), 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: install Xcode command line tools
- Windows: recommend using MinGW
- Ipopt CppAD
- Linux: run
./install-ubuntu-MPC.sh
- Refer
install_Ipopt_CppAD.md
for installation and troubleshooting instructions
- Linux: run
- uWebSockets
- run
./install-ubuntu.sh
or./install-mac.sh
depending on your platform
- run
- Simulator
- The simulator can be downloaded from the Udacity GitHub Repository
- The starter code and the script to install the libraries is adopted from Udacity GitHub Repository