Git Product home page Git Product logo

cbf's Introduction

cbf

This repo serves as a toolkit for testing different algorithm for control barrier functions.

Status: This repository is still under development, expecting new features/papers and a complete tutorial to explain it. Feel free to raise questions/suggestions through GitHub Issues, if you want to use the current version of this repository. Please watch and star for subscribing further updates which will be related to our latest preprints and published papers.

Citing

If you find this repository useful in your work, please consider citing following work:

@inproceedings{thirugnanam2022safety,
  title={Safety-Critical Control and Planning for Obstacle Avoidance between Polytopes with Control Barrier Functions},
  author={Thirugnanam, Akshay and Zeng, Jun and Sreenath, Koushil},
  booktitle={2022 IEEE International Conference on Robotics and Automation (ICRA)},
  year={2022}
}

Environments

  • Create your environment via conda env create -f environment.yml. The default conda environment name is cbf, and you could also choose that name with your own preferences by editing the .yml file.

Maze navigation with duality-based obstacle avoidance

This represents the implementation of the following paper:

  • A. Thirugnanam, J. Zeng, K. Sreenath. "Safety-Critical Control and Planning for Obstacle Avoidance between Polytopes with Control Barrier Functions." 2022 IEEE International Conference on Robotics and Automation (ICRA). [arXiv] [Video]

Run python models/kinematic_car_test.py. This simulates maze navigation (two maze setups) with duality-based obstacle avoidance (four robot shapes including rectangle, pentagon, triangle and l-shape) in the discrete-time domain. The animations and snapshots can be found in folder animations and figures. An example animation video can be generated as follows,

pentagon_oblique_maze.mp4

Contributors

Jun Zeng, Akshay Thirugnanam.

cbf's People

Contributors

akshaythiru avatar junzengx14 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cbf's Issues

[helper]: The role of \omega

I have problems in formula derivation. Very disturbing! Thank you very much!
In Section II. B, the authors state “Note that, due to the relaxation variable \omega, enforcing multiple DCBF constraints for each hi is equivalent to enforcing a single DCBF constraint.” I am confused about this issue. Why the relaxation variable \omega leads to this case? Is the statement not true without the relaxation variable \omega?
In Section III. C, the authors state “Additionally, we can introduce the relaxation
variables without affecting the analysis in this section.” Why?

Bug for def safe_dist(x, timestep, amin, amax, dist_margin):

I have a question about the code inside the function safe_dist(x, timestep, amin, amax, dist_margin) in kinematic_car.py.
Should the code:

brake_min_dist = (abs(x[2]) + amax * timestep) ** 2 / (2 * amax) + dist_margin

be changed to:

brake_min_dist = (abs(x[2]) + amax * timestep) ** 2 / (2 * abs(amin)) + dist_margin

even though in the current code amax = abs(amin)

am i right?

Apply CBF on discrete action space

Hello @junzengx14 @koushils @ayush-agrawal

Thanks for sharing this repo and your work in using CBF and CLF for the safety and stability of non-linear dynamic systems. I have read two of your papers, "Safety-Critical Control and Planning for Obstacle Avoidance between Polytopes with Control Barrier Functions" arxiv and "Enhancing Feasibility and Safety of Nonlinear Model Predictive Control with Discrete-Time Control Barrier Functions" IEEE.

Very interesting papers.

I am working on a similar project where the agent has discrete action space (left, right, forward etc.). As far as I understood, you have applied CBF-CLF in continuous action space (steering and acceleration).

Does this implementation of CBF also work for discrete action space?

Environment configuration issue

Dear Dr. Zeng,
I have some code problems. Very disturbing! Thank you very much!
I run this project in ubuntu18.04 and install required packages in python3.7. Is the following error caused by matplotlib's version?

The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
Traceback (most recent call last):
File "/home/highlight/cbf/models/kinematic_car_test.py", line 344, in
kinematic_car_all_shapes_simulation_test(maze_type, robot_shape)
File "/home/highlight/cbf/models/kinematic_car_test.py", line 257, in kinematic_car_all_shapes_simulation_test
plot_world(sim, robot_indexes, figure_name=name, local_traj_indexes=traj_indexes, maze_type=maze_type)
File "/home/highlight/cbf/models/kinematic_car_test.py", line 83, in plot_world
plt.savefig("figures/" + figure_name + ".eps", format="eps", dpi=500, pad_inches=0)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/pyplot.py", line 977, in savefig
res = fig.savefig(*args, **kwargs)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/figure.py", line 3058, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2325, in print_figure
**kwargs)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/_api/deprecation.py", line 415, in wrapper
return func(*inner_args, **inner_kwargs)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/backends/backend_ps.py", line 847, in print_eps
return self._print_ps(outfile, 'eps', **kwargs)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/_api/deprecation.py", line 389, in wrapper
return func(*inner_args, **inner_kwargs)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/backends/backend_ps.py", line 889, in _print_ps
orientation=orientation, papertype=papertype, **kwargs)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 1648, in wrapper
return func(*args, **kwargs)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/backends/backend_ps.py", line 1024, in _print_figure
with cbook.open_file_cm(outfile, "w", encoding="latin-1") as file:
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/cbook/init.py", line 465, in open_file_cm
fh, opened = to_filehandle(path_or_file, mode, True, encoding)
File "/home/highlight/anaconda3/envs/cbf/lib/python3.7/site-packages/matplotlib/cbook/init.py", line 451, in to_filehandle
fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'figures/triangle_maze.eps'

[helper]: add_convex_to_convex_constraint code understanding

Dear Dr. Thirugnanam
I have some code understanding problems. Very disturbing! Thank you very much!
dcbf_optimizer.py add_convex_to_convex_constraint function
What is the meaning and function of the following codes?
line 136 np.dot(robot_G, self.state.rotation().T)
line 137 np.dot(np.dot(robot_G, self.state.rotation().T), self.state.translation()) + robot_g
line 147 robot_R
line 163 robot_T
line 167 ca.mtimes((ca.mtimes(mat_A, robot_T) - vec_b).T, lamb[:, i])
line 171 ca.mtimes(ca.mtimes(robot_R.T, mat_A.T), lamb[:, i])
line 174 self.opti.subject_to(ca.mtimes(temp.T, temp) <= 1)

Add descriptive readme.

We need to maintain an update-to-date readme for tons of features in this repository, which allows all collaborators to test and run examples and source code in a fast pace. I will take responsibility and this is intended to carried out after ICRA deadline.

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.