GithubHelp home page GithubHelp logo

shuoyang2000 / neural_hybrid_cbf Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 36.07 MB

Code for "Learning Local Control Barrier Functions for Safety Control of Hybrid Systems" by S. Yang, Y. Chen, X. Yin, R. Mangharam

Home Page: ArXiv: https://arxiv.org/abs/2401.14907

License: MIT License

Dockerfile 0.16% Python 69.17% Jupyter Notebook 30.62% Shell 0.05%
autonomous-racing control-barrier-functions hybrid-systems machine-learning neural-pde

neural_hybrid_cbf's Introduction

Learning Local CBFs for Safety Control of Hybrid Systems

Preprint with supplementary material is available online.

Install

The implementation has been tested with Python 3.10 under Ubuntu 22.04. We recommend installing the simulation inside a virtualenv. You can install the environment by running:

virtualenv cbf_env
source cbf_env/bin/activate
git clone [email protected]:shuoyang2000/neural_hybrid_cbf.git
cd neural_hybrid_cbf
pip install -e .

Note that some supplementary libraries are included locally (in the lib folder). These libraries are bundled with the repository as changes are made to make them adapted to our project.

Docker

We also provide a Dockerfile to build a container if you prefer.

docker build -t cbf_container -f Dockerfile .

Reproduce the evaluation results

Python path

We run all experiments from the project directory so please add the project directory to the PYTHONPATH environment variable:

export PYTHONPATH=$PYTHONPATH:$

Evaluation commands

  1. For the autnomous racing environment, please run from the project directory:
python3 scripts/racing/main.py

For visualization, please run from the project directory:

python3 scripts/racing/visualization.py

You may change the method (mpc, local_switch_unaware_cbf, local_switch_aware_cbf, global_cbf) in the file scripts/racing/evaluation_config.py. The results will be saved under results/racing_results/.

  1. For the adaptive cruise control example, please run from the project directory:
python3 scripts/cruise_control/main.py

You may also run mpc.py similarly and test the costs by running cost.py in the same folder. Results will be saved under results/acc_results/.

Training

The trained model is saved in To reproduce the training, please run:

python3 train/train_acc.py --experiment_name experiment_acc --tMax 0. --tMin -1.1 --num_src_samples 10000 --pretrain --pretrain_iters 5000 --num_epochs 60000 --counter_end 50000

Other issues:

  1. F1/10th Car dynamics can be found here, please refer to Single-Track Model section.

  2. Some related projects:

  3. Contact: if you have any question on this repo, please feel free to contact the author Shuo Yang (yangs1 at seas dot upenn dot edu) or raise an issue.

Citation

If you find this work useful, please consider citing:

@article{yang2024learning,
  title={Learning Local Control Barrier Functions for Safety Control of Hybrid Systems},
  author={Yang, Shuo and Chen, Yu and Yin, Xiang and Mangharam, Rahul},
  journal={arXiv preprint arXiv:2401.14907},
  year={2024}
}

neural_hybrid_cbf's People

Contributors

shuoyang2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.