This repository is initiated by the final project of MECHENG 599 - Applied Optimal Control (2024 Fall) at University of Michigan - Ann Arbor. Model predictive control (MPC) and control barrier function (CBF) are used for robot motion planning problem with obstacle avoidance. The unicycle model is used as robot dynamics. Code is tested in Ubuntu operating system and it is implemented in Python 3.10. CasADi is used as optimization solver.
Disclaimer: This is NOT a research project. Some part might not be rigorous and suggestions are welcomed.
MPC-DC (N=25)
MPC-CBF (N=25, γ = 0.8)
Clone the project
git clone https://github.com/lihanlian/motion-planning-mpc
Go to project directory
python3 -m venv env && source env/bin/activate
pip install -r requirements.txt
- config.py defines parameters including prediction horizion(N), total time steps, gamma (for CBF), etc.
- run main.py to simulate feedback control loop and store the state and control trajectories.
- run visualization.py to get the animation.
- Two methods are used: mpc_dc and mpc_cbf. Choose one of them while running main.py and visualization.py. Adjust corresponding parameters in config.py if necessary.