Skip to content

C++ code for Assisted Lane Keeping using Model Predictive Controller

Notifications You must be signed in to change notification settings

sumukhpatil/Model-Predictive-Controller

Repository files navigation

Model Predictive Controller (MPC) for Assisted Lane Keeping

Introduction

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.

Project Build Instructions

Ubuntu

git clone https://github.com/sumukhpatil/Model-Predictive-Controller.git
cd Model-Predictive-Controller
mkdir build && cd build
cmake ..
make
./mpc

Build Dependencies

References

  1. The starter code and the script to install the libraries is adopted from Udacity GitHub Repository