{"id":24994264,"url":"https://github.com/hybridrobotics/cbf-convex-maps","last_synced_at":"2025-04-12T03:24:20.202Z","repository":{"id":238419029,"uuid":"519405017","full_name":"HybridRobotics/cbf-convex-maps","owner":"HybridRobotics","description":"A repository for enforcing CBF constraints between strictly convex sets.","archived":false,"fork":false,"pushed_at":"2025-02-06T22:01:34.000Z","size":2168,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T22:51:33.465Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HybridRobotics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-30T03:08:32.000Z","updated_at":"2025-03-25T11:38:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"f1eb83d8-bd17-4405-b4f0-9dc1bc4e608e","html_url":"https://github.com/HybridRobotics/cbf-convex-maps","commit_stats":null,"previous_names":["akshaythiru/cbf-convex-maps","hybridrobotics/cbf-convex-maps"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HybridRobotics%2Fcbf-convex-maps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HybridRobotics%2Fcbf-convex-maps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HybridRobotics%2Fcbf-convex-maps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HybridRobotics%2Fcbf-convex-maps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HybridRobotics","download_url":"https://codeload.github.com/HybridRobotics/cbf-convex-maps/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511030,"owners_count":21116336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-04T14:50:50.784Z","updated_at":"2025-04-12T03:24:20.196Z","avatar_url":"https://github.com/HybridRobotics.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cbf-convex-maps\nThis repository provides a method to enforce control barrier function (CBF) constraints between state-dependent convex sets, defined as smooth and strongly convex maps (see the reference below).\n\nWe provide the following features:\n- Geometry classes to define state-dependent strongly convex sets (smooth and strongly convex maps).\n- Ipopt solver interface to compute the minimum distance between strongly convex maps.\n- An ODE solver (the KKT solution ODE) that rapidly computes the minimum distance and KKT solutions along state trajectories. The KKT solutions can be used to compute the distance derivative and thus enforce CBF constraints (see the paper).\n\nFor a brief overview on how to use the repository, see the [usage file](https://github.com/HybridRobotics/cbf-convex-maps/blob/main/usage.ipynb).\nThe core algorithm is implemented in the [CollisionPair class](https://github.com/HybridRobotics/cbf-convex-maps/blob/main/src/collision/collision_pair.cc).\n\n---\n\n### Citing\nThe technical paper corresponding to this repository is in review (second round in SICON24).\n\n- Akshay Thirugnanam, Jun Zeng, Koushil Sreenath. \"Control Barrier Functions for Collision Avoidance Between Strongly Convex Regions.\" [[arXiv]](https://arxiv.org/abs/2306.13259)\n\n---\n\n### Requirements\n\nThe following C++ (\u003e= 17) libraries are required:\n- `Eigen` (\u003e= 3.4.90; install from the [source](https://eigen.tuxfamily.org/index.php?title=Main_Page))\n- `Ipopt` (install from [source](https://coin-or.github.io/Ipopt/INSTALL.html))\n- `OSQP` (install from [source](https://osqp.org/docs/get_started/sources.html))\n- `OSQPEigen` (install from [source](https://github.com/robotology/osqp-eigen))\n\nThe following Python libraries are required to generate the plots and visualizations in the paper (optional):\n- `numpy`\n- `scipy`\n- `matplotlib`\n- `meshcat-dev` (install from [source](https://github.com/meshcat-dev/meshcat-python))\n- `skimage` (for the marching cubes algorithm)\n- `polytope` (for polytope computations)\n\nTesting and benchmarks (optional) are done using the GoogleTest and Google Benchmark libraries.\nCode formatting is done via `pre-commit` hooks.\n\n### Build from source\n\n1. Clone the repository:\n    ```\n    git clone https://github.com/HybridRobotics/cbf-convex-maps.git\n    ```\n\n2. Build:\n    ```\n    cd cbf-convex-maps\n    mkdir build\n    cd build\n    cmake -DCMAKE_BUILD_TYPE=Release ../\n    ```\n    To prevent building tests and benchmarks, use the following cmake command:\n    ```\n    cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_BENCHMARKS=OFF ../\n    ```\n\n    Then, build:\n    ```\n    cmake --build .\n    ```\n\n3. To run the KKT ODE example, use:\n     ```\n     ./apps/sccbf_kkt_ode\n     ```\n     To run the CBF example, use:\n     ```\n     ./apps/sccbf_ma_cbf\n     ```\n\n4. (optional) To generate the plots, install the required Python libraries. Then, add the `apps/` directory to `PYTHONPATH`:\n     ```\n     export PYTHONPATH=$PYTHONPATH:\u003cpath-to-source-directory\u003e/apps/\n     ```\n     Then, run the Python files in `apps/plots/` to generate the plots.\n\n---\n\n### Examples\n\nThe examples in `apps/` consider two scenarios for a quadrotor system (see the paper for complete problem description and results).\n\nThe second example considers a scenario where the safe region of the quadrotor is given by the Minkowski sum of the quadrotor shape and a dynamic safety corridor depending on quadrotor orientation and velocity (see the figure below).\nThe dynamic safe region of the quadrotor (a Minkowski sum of strongly convex maps) can be represented as the projection of a strongly convex map in R6 onto R3.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/figures/quadrotor_corridor_safe_set.png\" width=90% height=90%\u003e\n\u003c/p\u003e\n\nThe following example shows our method for a quadrotor control task, where the quadrotor needs to safely navigate through an obstacle-filled corridor.\nCBF constraints are enforced between the 11 polyhedral obstacles and the dynamic safe region of the quadrotor.\nOur method enables fast computation of the minimum distance function and the minimum distance Lie derivatives using the KKT solutions.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/figures/cbf_snapshot.png\" width=90% height=90%\u003e\n\n\u003cimg src=\"docs/figures/cbf_dist.png\" width=45% height=45%\u003e\n\u003c/p\u003e\n\nFor the quadrotor collision avoidance example, the CBF-QP solution computation and all 11 KKT solution updates can be performed reliably at 500 Hz.\nIn particular, the KKT solution updates are generally performed within 10 microseconds (for each collision pair), which can be more than an order of magnitude faster than solving for the KKT solutions directly (even with warm start).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhybridrobotics%2Fcbf-convex-maps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhybridrobotics%2Fcbf-convex-maps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhybridrobotics%2Fcbf-convex-maps/lists"}