Skip to content

tkkim-robot/plcbf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Policy Library CBF: When safety filters meet parallelization

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.

Features

  • 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_car and warehouse cases
  • Optional safe-region plotting utilities in safe_region_plot/

Installation

  1. Clone with submodules:
git clone --recurse-submodules https://github.com/tkkim-robot/plcbf.git
cd plcbf
  1. If you already cloned without submodules:
git submodule update --init --recursive
  1. Install dependencies:
uv sync

Quick Start

1) Highway driving test case (8 states, 2 inputs)

uv run python examples/drift_car/test_drift_pcbf.py \
  --algo plcbf \
  --test puddle_surprise

2) Warehouse navigation test case with 3D quadrotor (12 states, 4 inputs)

uv run python examples/warehouse/test_warehouse_quad.py \
  --algo plcbf 

Useful Options

Highway Driving: examples/drift_car/test_drift_pcbf.py

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

Warehouse Navigation: examples/warehouse/test_warehouse_quad.py

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

Base Abstractions

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.

Citation

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}
}

About

Policy Library CBF: A runtime safety filter based on parallel rollouts of multiple fallback policies with a computation overhead of < 10 ms.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages