Following repository is a minimalistic environment for experimenting with Control Barrier Functions (CBF).
The classical benchmark cartpole is used as the plant model. To keep it simple no simulator is used; instead, full non-linear dynamics of the cartpole is integrated.
Folder structure (ordered with increasing difficulty):
-
acc.py
: Most well-known, simple example: adaptive cruise control via CBF-QP. (not related to cartpole) -
cartpole.py
: Cartpole dynamics and simulation, all controllers use it as plant -
nominal_control.py
: Nominal controllers -
cbf_qp.py
: Safety-Critical control with classical CBF, constrain cart velocity
CBF Enabled | CBF Disabled |
---|---|
ecbf_qp.py
: Exponential CBF with known model, constrain cart positioncbf_qp_learning
: Safety-Critical control with model uncertainty, CBF + learning (TODO)ecbf_qp_learning
: Exponential CBF with unknown model, ECBF + learning (TODO)cbf_qp_id.py
: CBF-QP embedded into inverse dynamics formulation.
- Clone the repository
git clone https://github.com/Berk-Tosun/cbf-cartpole
- Install required packages
pip install -r requirements.txt
Most python files in this project have a main guard. It means you can directly run them, e.g.:
python cbf_qp.py
This will generate one of the figures given in the introduction section.
-
Recommended introductory presentation: Jason Choi, UC Berkeley. Matching repository of the talk, where you can get the slides and the mentioned matlab code.
-
Presentation by the main author of the CBF framework, Prof. Aaron Ames.
-
Another introductory presentation: Air Lab Summer School 2020.
-
Sample hardware application: Multi-Layered Safety for Legged Robots via Control Barrier Functions and Model Predictive Control. Its presentation from ICRA 2021.