vehicle-mpc-controller
vehicle-mpc-controller copied to clipboard
Simple library to simulate, test and tune Model Predictive Control (MPC) for autonomous vehicles.
trafficstars
vehicle-mpc-controller
- Library for simulating, testing and tuning a Model Predictive Controller (MPC) for autonomous vehicles.
- Currently the code uses either a unicycle or bicycle model (with ackermann steering) to model the dyanmics of the vehicle.
- The objective of the controller is to track a given reference trajectory in the presence of added process noise.
- The non-linear dynamics of the system are linearized about the reference trajectory.
- The MPC problem for the linearized system is then cast as a constrained Quadratic Programming (QP) problem.
- The constrained QP problem is solved using the OSQP optimization library and its C++/Eigen wrapper
Dependencies
- boost v1.58
- osqp
- osqp-eigen
- Eigen3
- cmake v3.0+
- googletest (only for testing).
Third-party software used:
- spdlog - For logging/debugging
- json - For reading in params
- matplotlib-cpp - For plotting
Building
Linux
git clone https://github.com/vTechSavyy/vehicle-mpc-controller.git
cd vehicle-mpc-controller
mkdir build && cd build
cmake ../
make
Running an example:
./mpc-bicycle-double-lane-change
The params of the simualtion and mpc-controller are set through a json file in the params folder
Results
Bicycle model - Lane change maneuver

Bicycle model - Double lane change maneuver

References:
Todo list:
- Interface this library with a high-level planner that provides the reference
- Interface with an open source simualtor (eg: Gazbeo or Webots) for better testing
- Parmeterize the linearized error dynamics in terms of lateral and longitudinal errors w.r.t the reference trajectory.
- Compare mpc with other control methods (eg: Pure pursuit, PID)
- Any further suggestions/feedback is always welcome.