A modular simulation framework for Python ultra-rapid prototyping of self-adaptive, stochastic and robust Nonlinear Model Predictive Control (NMPC) for Autonomous Vehicle Motion Control developed by the TUM CONTROL Team of the Autonomous Vehicle Systems Lab (AVS) at TUM.
The TUM Motion Control simulation framework includes the following base NMPC motion controller:
- Nominal NMPC
- Stochastic NMPC (SNMPC)
- Reduced Robustified NMPC (R²NMPC) (coming-soon)
SNMPC in action on Monteblaco Racetrack:
Each NMPC has the following characteristics:
- Combined lateral- & longitudinal motion control for trajectory following
- Dynamic nonlinear single track prediction model with Pacejka tire model in CasADi
- Nonlinear constraints:
- Combined lateral- & longitudinal acceleration limits
- Actuator limits
The TUM Control simulation framework includes:
- Trajectory Planner emulator that contains a catalog of challenging trajectories
- Vehicle dynamics model: currenty a nonlinear single track prediction model with Pacejka tire, currently parametrized and validated using real-world data on a Volkswagen T7 (EDGAR). TODO:
- 2D live track & vehicle motion visualization
- Closed-loop Performance analysis & MPC Debugging
- MPC experiments benchmarking
- Capability to isolate the controller from the rest of the software and thus guarantee a static environment for rapid prototyping
- Automatic C++ Code Generation with ACADOS
- Developed packages can easily be integrated into the rest of the software stack for autonomous driving or Hardware-in-the-Loop simulations as well as be deployed on the vehicle.
Tested on:
- Ubuntu 20.04 LTS
- Ubuntu 22.04 LTS
- Mac OSX Ventura 13.01 Python version should be at least 3.7 and at last 3.9
Compile and install ACADOS by following:
We recommend you to create a new python virtual environment. Example with Python 3.9:
- create virtual environment:
sudo apt install python3.9-venv
python3.9 -m venv <Path>/tum-control-venv
- activate the virtual environment
source <Path>/tum-control-venv/bin/activate
- clone this repository
git clone [email protected]:bzarr/tum-control.git
- install missing packages using pip requirements.txt
pip install -r tum-control/Python/requirements.txt
- Link ACAODS Python Interface
pip install -e <acados_root>/interfaces/acados_template
- Don't forget to add the path to the compiled shared libraries and to source ACADOS (https://docs.acados.org/python_interface/index.html):
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"<acados_root>/lib"
export ACADOS_SOURCE_DIR="<acados_root>"
Example:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/home/alienware2/acados/lib"
export ACADOS_SOURCE_DIR="/home/alienware2/acados"
- It may occur that you need to install tkinter for the matplotlib animation.
sudo apt install python3-tk
To start the simulation, run the main file "main.py"
Simulation parameters are in Config/sim_main_params.yaml
simulation mode | description |
---|---|
0 | CiL (Controller-Vehicle in Loop): simulation model= separate vehicle dynamics model |
1 | MPC Sim (MPC in Loop): simulation model= MPC predictions |
-
loads MPC parameters from /Config folder
-
loads reference trajectory and track .json file from /Config folder
-
gets the starting index of the vehicle on the trajectory and sets the initial state of the vehicle
-
loads vehicle simulator from /Vehicle_Simulator folder
-
loads MPC ACADOS formulation from /TUM_Motion_Controller folder
-
sets initial MPC state constraint
-
configures live visualization, if the option is set to True
-
starts the simulation loop:
- gets current reference trajectory from the simple trajectory planner emulator defined in /Utils/MPC_sim_utils.py : TBD: PLANNER EMULATOR FEATURES DESCRIPTION
- updates the MPC reference
$y_{ref}$ for all intermediate shooting nodes (1 to N-1) and$y^e_{ref}$ for the terminal shooting node N - solves the MPC problem, gets and logs the solution
- extracts current MPC predicitons
- extracts and logs solver debugging information
- logs current reference
- makes one simulation step and updates current vehicle kinematic state
- updates initial MPC state constraint
- live simulation visualization, if the option is set to True
-
post-processing
-
generates performance analysis plots
The owner of TUM-CONTROL is Baha Zarrouki ([email protected]). The following students made major contributions to this framework throughout their thesis:
- Joao Nunes (Robust NMPC)
- Chenyang Wang (Stochastic NMPC (SNMPC) and Reinforcement Learning driven adaptive SNMPC (aSNMPC))
- Marios Spanakakis (Safe Reinforcement Learning driven Weights-varying MPC with Pareto-Optimal sets)
DRL driven adaptive SNMPC
B. Zarrouki, V. Klös, N. Heppner, S. Schwan, R. Ritschel and R. Voßwinkel, "Weights-varying MPC for Autonomous Vehicle Guidance: a Deep Reinforcement Learning Approach," 2021 European Control Conference (ECC), Delft, Netherlands, 2021, pp. 119-125, doi: 10.23919/ECC54610.2021.9655042. https://ieeexplore.ieee.org/abstract/document/9655042
B. Zarrouki, C. Wang and J. Betz, "A Stochastic Nonlinear Model Predictive Control with an Uncertainty Propagation Horizon for Autonomous Vehicle Motion Control," 2024 American Control Conference (ACC), Toronto, ON, Canada, 2024, pp. 5466-5473, doi: 10.23919/ACC60939.2024.10645032. https://ieeexplore.ieee.org/abstract/document/10645032
B. Zarrouki, J. Nunes, and J. Betz, "R²NMPC: A Real-Time Reduced Robustified Nonlinear Model Predictive Control with Ellipsoidal Uncertainty Sets for Autonomous Vehicle Motion Control." IFAC-PapersOnLine 58.18 (2024): 309-316. https://www.sciencedirect.com/science/article/pii/S2405896324014277
Zarrouki, B., Wang, C., & Betz, J. (2023). Adaptive Stochastic Nonlinear Model Predictive Control with Look-ahead Deep Reinforcement Learning for Autonomous Vehicle Motion Control. https://arxiv.org/abs/2311.04303
B. Zarrouki, M. Spanakakis and J. Betz, "A Safe Reinforcement Learning driven Weights-varying Model Predictive Control for Autonomous Vehicle Motion Control," 2024 IEEE Intelligent Vehicles Symposium (IV), Jeju Island, Korea, Republic of, 2024, pp. 1401-1408, doi: 10.1109/IV55156.2024.10588747. https://ieeexplore.ieee.org/document/10588747