This repository is about using model predictive control (MPC) and control barrier function (CBF) for robot motion planning problem with obstacle avoidance. Two methods are used: one is using eulidean distance (MPC-DC) and the other is using CBF for safety guarantee. Python and CasADi are used for implementation. It is initiated by the final project of AEROSP 740 - Model Predictive Control (2024 Winter) at University of Michigan - Ann Arbor.
Disclaimer: This is NOT a research project. Some part might not be rigorous and suggestions are welcomed.
MPC-DC Reuslts
MPC-CBF Results
Clone the project
git clone https://github.com/lihanlian/simple-mpc-cbf.git
Go to project directory
python3 -m venv env && source env/bin/activate
pip install -r requirements.txt
- run mpc_dc_static.py and mpc_dc_static_and_dynamic.py to generate pickle files that store robot state and control input information for MPC-DC algorithm.
- run mpc_cbf_static.py and mpc_cbf_static_and_dynamic.py to generate pickle files that store robot state and control input information for MPC-CBF algorithm.
- run plot.ipynb to load data and visualize results.
- Adjust hyperparameters (preidction horizon N and cbf parameter γ) if necessary.
- Some hyperparameters might result in bad result such as moving from one place to another instantaneously in a unreasonable way. This might be due to the nonlinearity and feasibility properties of optimization problem, and the optimization solver fail to get a good solution.
The author would like to appreciate the course instructor Professor Ilya Kolmanovsky for his help throughout the semester and discussion during office hours. Below are some good resources that might be helpful on related topics.