This repository contains the scripts required to reproduce the simulation results in our paper "Preventing Inactive CBF Safety Filters Caused by Invalid Relative Degree Assumptions."
This was tested on Ubuntu 20.04.
Create a data directory. You can modify the data directory by updating the entry "data_dir" in configs/config.json.
cd
mkdir multi-cbf-simClone this repository.
git clone https://github.com/lukasbrunke/multi-cbf.git
cd multi-cbf/Create conda environment:
conda env create -f environment.ymlCreate a new wandb.ai project and modify the name of the project by setting "wandb_project" to the name of your project in configs/config.json. If you don't want to use wandb.ai, you can deactivate it by setting "wandb_project": "".
- Step (OPTIONAL): Run the multi-CBF synthesis. This step is optional. Instead of running this you may directly use the synthesized CBFs and start from step 2. The synthesis is a sampling-based approach that is implemented using multi-threading. You may set all the desired parameters in the associated config file.
python synthesize_cbfs.py --config configs/config_synthesis.jsonDepending on the setttings (especially the number of samples) and available cores, this may take more or less time. The default settings here took about 2 hours using 12 workers on my laptop, but could be significantly reduced to achieve satisfactory results. To analyze the resulting CBFs run the following:
python analyze_cbfs.py synthesized_cbfs/successful_samples_20250826_103440_2.npyIf you ran your own synthesis, you will have to replace the date and time stamp accordingly.
- Step: Run the
main.pyscript:
python3 main.py --config configs/config_multi_100hz.jsonChoose the appropriate config file for generating the desired result from the paper, for example, use the config file config_multi_100hz.json to use the multi-CBF safety filter running at 100 Hz.
To tighten the safe set, the same config has to be run twice. For the first run, the entry "run_name" should be null. For the second run, the entry "run_name" should be set to the appropriate wandb.ai run name. As stated in the paper, this only applies to the config file config_multi_10000hz.json.
The results can be visualized using the plotting script. Modify the config to either specify the run_name (from wandb.ai), the file_name (where the results are stored), or use_latest as true to plot and save the results from the latest run.
python3 plot_data.py --config configs/config_plot.jsonFor convenience, the plots are also saved as .tex and .png files.
The different configs generate the following figures:
Single-CBF safety filter at 10 kHz:
Single-CBF safety filter at 100 Hz:
Multi-CBF safety filter at 10 kHz:
Multi-CBF safety filter at 10 kHz with safe set tightening:
Multi-CBF safety filter at 100 Hz:
Please cite our work as:
@ARTICLE{multicbf2025,
title={Preventing Inactive CBF Safety Filters Caused by Invalid Relative Degree Assumptions},
journal={IEEE Transactions on Automatic Control},
author={Lukas Brunke and Siqi Zhou and Angela P. Schoellig},
year={2025},
note={accepted},
}Learning Systems and Robotics Lab at the Technical University of Munich (TUM) and the University of Toronto




