{"id":20879819,"url":"https://github.com/shaoanlu/mppi_cbf","last_synced_at":"2025-04-10T02:29:14.761Z","repository":{"id":199740940,"uuid":"703643184","full_name":"shaoanlu/mppi_cbf","owner":"shaoanlu","description":"Colab notebooks showcasing experiments on MPPI (model predictive path integral control) and CBF (control barrier function). Utilizes jax to accelerate computation.","archived":false,"fork":false,"pushed_at":"2025-02-25T10:13:26.000Z","size":36215,"stargazers_count":64,"open_issues_count":1,"forks_count":14,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-03T01:13:27.496Z","etag":null,"topics":["control-barrier-functions","jax","model-predictive-control","mppi","safety-filter"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaoanlu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-10-11T16:13:36.000Z","updated_at":"2025-04-01T06:18:35.000Z","dependencies_parsed_at":"2024-04-18T11:51:20.804Z","dependency_job_id":"5aff6d9a-de7f-4f5d-b705-c32140776043","html_url":"https://github.com/shaoanlu/mppi_cbf","commit_stats":null,"previous_names":["shaoanlu/mppi_cbf_playground","shaoanlu/mppi_cbf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaoanlu%2Fmppi_cbf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaoanlu%2Fmppi_cbf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaoanlu%2Fmppi_cbf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaoanlu%2Fmppi_cbf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaoanlu","download_url":"https://codeload.github.com/shaoanlu/mppi_cbf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248143999,"owners_count":21054862,"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":["control-barrier-functions","jax","model-predictive-control","mppi","safety-filter"],"created_at":"2024-11-18T07:17:57.107Z","updated_at":"2025-04-10T02:29:14.735Z","avatar_url":"https://github.com/shaoanlu.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mppi_cbf_playground\nColab notebooks of personal experiments with MPPI and CBF. Each notebook is stand-alone and can be executed immediately in Colab without extra setup.\n\n## Content\n\n\n| Nominal Controller | Safety Filter               | Model                                   | Colab Link                                                                                                                                                                                             |\n| ------------------ | --------------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| CLF-QP               | CBF-QP                    | Omnidirectioal Robot                             | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/shaoanlu/mppi_cbf_playground/blob/main/omnirobot_numpy_composite_clfcbf.ipynb)         |\n| MPPI               | CBF cost                    | Unicycle car                             | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/shaoanlu/mppi_cbf_playground/blob/main/bicycle_mppi_cbf_shielding.ipynb)         |\n|                    | CBF-QP                      | Unicycle car                             | Same as above                                                                                                                                                                                          |\n|                    | Nonlinear predictive filter | Unicycle car                             | Same as above                                                                                                                                                                                          |\n| MPPI               | CBF cost                    | Planar quadrotor                        | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/shaoanlu/mppi_cbf_playground/blob/main/planar_quadrotor_mppi_cbf.ipynb)          |\n| [Sequential QP](https://hybrid-robotics.berkeley.edu/publications/ACC2016_Safety_Control_Planar_Quadrotor.pdf)         | CLF-CBF-QP                    | Planar quadrotor | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/shaoanlu/mppi_cbf_playground/blob/main/planar_quadrotor_cbf_clf_qp.ipynb) |\n| MPPI               | CBF cost                    | Planar quadrotor with a suspended payload | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/shaoanlu/mppi_cbf_playground/blob/main/planar_quadrotor_pendulum_mppi_cbf.ipynb) |\n\n## Demonstrations\n### Demo 1: bicycle car\nThe following animations are simulation result of MPPI controller for obstacle avoidance.\n- Left: w/ CBF as a cost term in MPPI.\n- Middle: w/ a CBFQP safety filter.\n- Right: w/ a nonlinear predictive safety filter.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/bicycle_mppi_cbf_anim.gif\" width=250\u003e \u003cimg src=\"assets/bicycle_mppi_cbfqp_anim.gif\" width=250\u003e \u003cimg src=\"assets/bicycle_mppi_shielding_anim.gif\" width=250\u003e\n\u003c/p\u003e\n\n### Demo 2: planar quadrotor with MPPI controller\nThe following animations are simulation result of MPPI controller with CBF cost for obstacle avoidance.\n- Left: w/ CBF as a cost term in MPPI.\n- Right: w/ CBF as a cost term in MPPI. A suspended payload is attached to the quadrotor.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/2Dquadrotor_mppi_cbf_anim.gif\" width=250\u003e \u003cimg src=\"assets/2Dquadrotor_pendulum_mppi_cbf_anim.gif\" width=250\u003e\n\u003c/p\u003e\n\n### Demo 3: plannar quadrotor with CLF-CBF-QP controller\nThe following figures show a closed-loop simulation result of sequential CLF-QP controller w/ and w/o CBF as a constraint.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/sequentisl-clf-cbf-qp.png\" width=350\u003e\n\u003c/p\u003e\n\n### Demo 4: Closed-form solution of CLF-CBF-QP controller\nThe following figures show a simulation result of CLF-QP controller w/ a safety filter using composite CBF.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/numpy_clfcbfqp.gif\" width=250\u003e\n\u003c/p\u003e\n\n\n### Note for implementations\n- The terminal cost in MPPI is significant. It enhances the quality of the control sequence's prior, thereby preventing the controller from inadvertently deviating the system from its target position.\n- The discrete CBF cost aligns well with sampling-based predictive controllers, introducing only minimal additional computation.\n- The guarantees provided by CBF-QP diminish with discretization.\n\n\n### References\n1. Yin, Ji, et al. \"Shield Model Predictive Path Integral: A Computationally Efficient Robust MPC Approach Using Control Barrier Functions.\" arXiv preprint arXiv:2302.11719 (2023). https://arxiv.org/abs/2302.11719\n2. Ames, Aaron D., et al. \"Control barrier functions: Theory and applications.\" 2019 18th European control conference (ECC). IEEE, 2019. https://arxiv.org/abs/1903.11199\n3. Wu, Guofan, and Koushil Sreenath. \"Safety-critical control of a planar quadrotor.\" 2016 American control conference (ACC). IEEE, 2016.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaoanlu%2Fmppi_cbf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaoanlu%2Fmppi_cbf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaoanlu%2Fmppi_cbf/lists"}