tatsuyah / Model-Predictive-Control

C++ implementation of Model Predictive Control(MPC)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Model Predictive Control(MPC)

A C++ implementation of Model Predictive Control(MPC)

Demo video (YouTube)

Overview

Model Predictive Control is a feedback control method to get a appropriate control input by solving optimization problem.

For autonomous vehicle, control input means steering wheel and throttle(and break pedal). Assuming we know reference trajectory, we predicte next N steps' waypoints according to kinematic model(for simplicity) over some pattern, and calculate cost function for each to find most appropriate predicted trajectory. Then we use the first control input of the predicted trajectory and throw away the other trajectory. That's it. We only need to repeat this.

Implementation code is in MPC.cpp and main.cpp

Kinematic model equations

Kinematic model handles several status: car's x, y position, orientation, velocity, cross track error(= cte: distance between reference trajectory and actual trajectory), orientation error(= epsi: difference between desired orientation and current orientation). And belows are equations to calculate those at next timestep.

About

C++ implementation of Model Predictive Control(MPC)

License:MIT License


Languages

Language:C++ 83.0%Language:Fortran 11.5%Language:C 2.0%Language:CMake 1.8%Language:Cuda 1.1%Language:Shell 0.2%Language:Ruby 0.1%Language:Python 0.1%Language:JavaScript 0.1%Language:CSS 0.0%