[MPC] Model Predictive Control with discrete-time Control Barrier Functions

October 30, 2023

The MPC-CBF optimization problem is given by:

$$\begin{aligned} \min_{u_{t: t+N-1 \mid t}} \quad & \frac{1}{2} \tilde{x}_N^T Q_x \tilde{x}_N+\sum_{k=0}^{N-1} \frac{1}{2} \tilde{x}_k^T Q_x \tilde{x}_k+\frac{1}{2} u_k^T Q_u u_k\\ \textrm{s.t.} \quad & x_{t+k+1 \mid t}=x_{t+k \mid t}+f\left(x_{t+k \mid t}, u_{t+k \mid t}\right) \cdot T_s, \quad k=0, . ., N-1,\\ & x_{\min } \leq x_{t+k \mid t} \leq x_{\max }, \quad k=0, \ldots, N-1,\\ & u_{\min } \leq u_{t+k \mid t} \leq u_{\max }, \quad k=0, \ldots, N-1, \\ & x_{t \mid t}=x_t, \\ & \Delta h\left(x_{t+k \mid t}, u_{t+k \mid t}\right) \geq-\gamma h\left(x_{t+k \mid t}\right), \quad k=0, \ldots, N-1 \\ \end{aligned}$$

where $\tilde{x}_k=x_{des,k} - x_{k}$

Results

Scenario 1

Scenario 3

Scenario 4

Scenario 5

Scenario 6

Gazebo simulation with turtlebot3

Installation

To use this project, install it locally via:

git clone https://github.com/phatcvo/MPC-CBF.git

The dependencies can be installed by running:

pip install -r requirements.txt

The controller configuration can be changed through the config.py.

To execute the code, run:

python3 main.py

References