2021-07-28 12:20:32 +08:00
**Status:** This repository is archived. For latest work about discrete-time CBF, please refer to the collection repository: [CLF-CBF-NMPC ](https://github.com/HybridRobotics/CLF-CBF-NMPC ).
2020-09-25 05:24:22 +08:00
# MPC-CBF
2021-01-29 13:35:32 +08:00
We propose a control framework which unifies the model predictive control and control barrier functions, where terminal cost function serves as control Lyapunov functions for stability. This is the reference implementation of our paper:
2020-12-21 11:26:06 +08:00
### Safety-Critical Model Predictive Control with Discrete-Time Control Barrier Function
2021-02-25 17:26:33 +08:00
[PDF ](https://arxiv.org/abs/2007.11718 ) | [Code: Double Integratror ](examples ) | [Code: Car Racing ](https://github.com/HybridRobotics/Car-Racing )
2020-12-21 11:26:06 +08:00
*Jun Zeng, Bike Zhang and Koushil Sreenath*
#### Citing
2021-05-23 10:00:02 +08:00
If you find this project useful in your work, please consider citing following work:
2021-03-29 08:40:14 +08:00
```
2021-05-23 10:00:02 +08:00
@inproceedings {zeng2021mpccbf,
2020-12-21 11:26:06 +08:00
title={Safety-critical model predictive control with discrete-time control barrier function},
author={Zeng, Jun and Zhang, Bike and Sreenath, Koushil},
2021-03-29 08:40:14 +08:00
booktitle={2021 American Control Conference (ACC)},
year={2021}
2020-12-21 11:26:06 +08:00
}
```
2021-01-29 13:35:32 +08:00
#### Instructions
2021-02-25 17:26:33 +08:00
The 2D double integrator is assigned to reach the target position at origin while avoiding obstacles. We have three classes for different controllers: `DCLFDCBF.m` (DCLF-DCBF), `MPCCBF.m` (MPC-CBF) and `MPCDC` (MPC-DC), respectively.
2021-01-29 13:35:32 +08:00
Moreover, to illustrate the performance among them, we have:
2021-02-25 17:26:33 +08:00
* `test.m` : Run DCLF-DCBF/MPC-CBF/MPC-DC respectively.
* `testGamma.m` : Run analysis for different hyperparameter $\gamma$.
* `testHorizon.m` : Run analysis for different horizon.
* `testBenchmark.m` : Run analysis for some benchmark.
2021-01-29 13:35:32 +08:00
We illustrate the performance between DCLF-DCBF/MPC-DC/MPC-CBF
| DCLF-DCBF | MPC-DC (N=8) |
| --- | --- |
2021-02-25 17:26:33 +08:00
| < img src = "examples/figures/dclf-dcbf-avoidance.png" width = "200" height = "200" > | < img src = "examples/figures/mpc-dc-avoidance.png" width = "200" height = "200" > |
2021-01-29 13:35:32 +08:00
| MPC-CBF (N=1) | MPC-CBF (N=8) |
| --- | --- |
2021-02-25 17:26:33 +08:00
| < img src = "examples/figures/mpc-cbf-avoidance-one-step.png" width = "200" height = "200" > | < img src = "examples/figures/mpc-cbf-avoidance-several-steps.png" width = "200" height = "200" > |
2021-01-29 13:35:32 +08:00
and also the safety performance for different numbers of horizon and hyperparameters
| Different hyperparameter | Different horizon |
| --- | --- |
2021-02-25 17:26:33 +08:00
| < img src = "examples/figures/benchmark-gamma.png" width = "200" height = "200" > | < img src = "examples/figures/benchmark-horizon.png" width = "200" height = "200" >
2020-12-21 11:26:06 +08:00
2021-01-29 13:35:32 +08:00
#### Dependencies
2020-09-25 05:24:22 +08:00
The packages needed for running the code are [Yalmip ](https://yalmip.github.io/ ) and [IPOPT ](https://projects.coin-or.org/Ipopt/wiki/MatlabInterface ).
2021-01-29 13:35:32 +08:00
We also provide the zipped version of precompiled .mex files for IPOPT in the folder `packages` in case you don't have it. Unzip that file and add those .mex files into your MATLAB path.