/mpc-cbf

Model Predictive Control with discrete-time Control Barrier Functions (MPC-CBF).

Primary LanguagePythonMIT LicenseMIT

mpc-cbf

Model Predictive Control with discrete-time Control Barrier Functions (MPC-CBF) for a wheeled mobile robot.

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

Path comparison for different values of γ for MPC-CBF and with MPC-DC


Path comparison

MPC-CBF


Robot path


Trajectories

Scenario 3


Robot path


CBF values

Scenario 4


Robot path


CBF values


Trajectories

Scenario 5


Robot path

Scenario 6


Robot path


CBF values

Gazebo simulation with turtlebot3

Installation

To use this project, install it locally via:

git clone https://github.com/elena-ecn/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

License

The contents of this repository are covered under the MIT License.

References