This repository implements Policy Library CBF (PL-CBF). PL-CBF is motivated by Backup CBF and Policy CBF. Unlike single-fallback safety filters, PL-CBF leverages a finite library of candidate closed-loop policies and certifies safety whenever at least one library policy remains safe over the planning horizon. The rollouts are computed in parallel using JAX. The method certifies safety on the fly , requiring no offline value function computation.
- A runtime safety filter based on Policy-Library CBF (PL-CBF) that minimally modifies the pre-defined nominal policy (e.g., MPC, RL, etc.), without requiring any offline CBF design.
- JAX-accelerated parallel implementation for fast runtime performance (< 10 ms for 8 states and 12 states robots on a Macbook Air)
- Implemented baseline safety filters such as Model Predictive Shielding (MPS), gatekeeper, Backup CBF, and Policy PCBF.
- Integration with the safe_control repository for simulating robotic navigation, offering various robot dynamics and controllers.
- Unified base abstractions in
plcbf/plcbf.py - Script-level tests and benchmarks for both
drift_carandwarehousecases - Optional safe-region plotting utilities in
safe_region_plot/
- Clone with submodules:
git clone --recurse-submodules https://github.com/tkkim-robot/plcbf.git
cd plcbf- If you already cloned without submodules:
git submodule update --init --recursive- Install dependencies:
uv syncuv run python examples/drift_car/test_drift_pcbf.py \
--algo plcbf \
--test puddle_surpriseuv run python examples/warehouse/test_warehouse_quad.py \
--algo plcbf | Option | Description |
|---|---|
--test |
puddle_surprise, high_friction, low_friction, straight_safe, far_left_safe, all |
--algo |
mps, gatekeeper, backupcbf, pcbf, plcbf |
--backup |
lane_change, lane_change_left, lane_change_right, stop |
--obs |
Number of obstacles (1 or 2) |
--no-render |
Headless run |
--save |
Save animation |
| Option | Description |
|---|---|
--algo |
mps, gatekeeper, backupcbf, pcbf, plcbf |
--level |
7 (default), 1 to 6 |
--plcbf_num_angle_policies |
64 (default): Number of PLCBF angle fallback policies |
--no_render |
Headless run |
--save |
Save animation |
The base abstractions are in plcbf/plcbf.py. To build custom test cases, first define your robot's dynamics in safe_control/robots and the test environment in safe_control/envs. Then, create a new test script in examples/ that imports the base abstractions and your custom dynamics and environment.
More robot dynamics (not supported yet) can be found in safe_control/robots.
If you find this repository useful, please consider citing our paper:
@inproceedings{kim2026plcbf,
author = {Kim, Taekyung and Okamoto, Hideki and Hoxha, Bardh and Fainekos, Georgios and Panagou, Dimitra},
title = {Policy Library CBF: Finite-Horizon Safety at Runtime via Parallel Rollouts},
booktitle = {arXiv},
shorttitle = {PLCBF},
year = {2026}
}

