{"id":13466460,"url":"https://github.com/commaai/panda","last_synced_at":"2025-05-13T19:16:47.933Z","repository":{"id":37444784,"uuid":"87490037","full_name":"commaai/panda","owner":"commaai","description":"code powering the comma.ai panda","archived":false,"fork":false,"pushed_at":"2025-04-25T20:44:33.000Z","size":11794,"stargazers_count":1577,"open_issues_count":74,"forks_count":828,"subscribers_count":94,"default_branch":"master","last_synced_at":"2025-04-25T21:31:10.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/commaai.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,"zenodo":null}},"created_at":"2017-04-07T01:11:08.000Z","updated_at":"2025-04-25T20:44:35.000Z","dependencies_parsed_at":"2023-02-15T14:01:34.632Z","dependency_job_id":"5614313a-3fe9-496c-a808-f8e5a1a5fe82","html_url":"https://github.com/commaai/panda","commit_stats":{"total_commits":2035,"total_committers":88,"mean_commits":23.125,"dds":0.8113022113022113,"last_synced_commit":"e4cc97d8826dc95a7833b859c36948302445a499"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commaai%2Fpanda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commaai%2Fpanda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commaai%2Fpanda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commaai%2Fpanda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commaai","download_url":"https://codeload.github.com/commaai/panda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250901439,"owners_count":21505152,"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":"2024-07-31T15:00:44.497Z","updated_at":"2025-04-28T10:49:47.148Z","avatar_url":"https://github.com/commaai.png","language":"C","funding_links":[],"categories":["C","Hardware"],"sub_categories":["ARM"],"readme":"# Welcome to panda\n\n![panda tests](https://github.com/commaai/panda/workflows/tests/badge.svg)\n![panda drivers](https://github.com/commaai/panda/workflows/drivers/badge.svg)\n\npanda speaks CAN and CAN FD, and it runs on [STM32F413](https://www.st.com/resource/en/reference_manual/rm0430-stm32f413423-advanced-armbased-32bit-mcus-stmicroelectronics.pdf) and [STM32H725](https://www.st.com/resource/en/reference_manual/rm0468-stm32h723733-stm32h725735-and-stm32h730-value-line-advanced-armbased-32bit-mcus-stmicroelectronics.pdf).\n\n## Directory structure\n\n```\n.\n├── board           # Code that runs on the STM32\n├── drivers         # Drivers (not needed for use with Python)\n├── python          # Python userspace library for interfacing with the panda\n├── tests           # Tests and helper programs for panda\n```\n\n## Safety Model\n\npanda is compiled with safety firmware provided by [opendbc](https://github.com/commaai/opendbc). See details about the car safety models, safety testing, and code rigor in that repository.\n\n## Code Rigor\n\nThe panda firmware is written for its use in conjunction with [openpilot](https://github.com/commaai/openpilot). The panda firmware, through its safety model, provides and enforces the\n[openpilot safety](https://github.com/commaai/openpilot/blob/master/docs/SAFETY.md). Due to its critical function, it's important that the application code rigor within the `board` folder is held to high standards.\n\nThese are the [CI regression tests](https://github.com/commaai/panda/actions) we have in place:\n* A generic static code analysis is performed by [cppcheck](https://github.com/danmar/cppcheck/).\n* In addition, [cppcheck](https://github.com/danmar/cppcheck/) has a specific addon to check for [MISRA C:2012](https://misra.org.uk/) violations. See [current coverage](https://github.com/commaai/panda/blob/master/tests/misra/coverage_table).\n* Compiler options are relatively strict: the flags `-Wall -Wextra -Wstrict-prototypes -Werror` are enforced.\n* The [safety logic](https://github.com/commaai/panda/tree/master/opendbc/safety) is tested and verified by [unit tests](https://github.com/commaai/panda/tree/master/opendbc/safety/tests) for each supported car variant.\nto ensure that the behavior remains unchanged.\n* A hardware-in-the-loop test verifies panda's functionalities on all active panda variants, including:\n  * additional safety model checks\n  * compiling and flashing the bootstub and app code\n  * receiving, sending, and forwarding CAN messages on all buses\n  * CAN loopback and latency tests through USB and SPI\n\nThe above tests are themselves tested by:\n* a [mutation test](tests/misra/test_mutation.py) on the MISRA coverage\n\nIn addition, we run the [ruff linter](https://github.com/astral-sh/ruff) and [mypy](https://mypy-lang.org/) on panda's Python library.\n\n## Usage\n\nSetup dependencies:\n```bash\n# Ubuntu\nsudo apt-get install dfu-util gcc-arm-none-eabi python3-pip libffi-dev git clang-17\n\n# macOS\nbrew install --cask gcc-arm-embedded\nbrew install python3 dfu-util gcc@13\n```\n\nClone panda repository and install:\n``` bash\ngit clone https://github.com/commaai/panda.git\ncd panda\n\n# install dependencies\npip install -e .[dev]\n\n# install panda\npython setup.py install\n```\n\nSee [the Panda class](https://github.com/commaai/panda/blob/master/python/__init__.py) for how to interact with the panda.\n\nFor example, to receive CAN messages:\n``` python\n\u003e\u003e\u003e from panda import Panda\n\u003e\u003e\u003e panda = Panda()\n\u003e\u003e\u003e panda.can_recv()\n```\nAnd to send one on bus 0:\n``` python\n\u003e\u003e\u003e from opendbc.car.structs import CarParams\n\u003e\u003e\u003e panda.set_safety_mode(CarParams.SafetyModel.allOutput)\n\u003e\u003e\u003e panda.can_send(0x1aa, b'message', 0)\n```\nNote that you may have to setup [udev rules](https://github.com/commaai/panda/tree/master/drivers/linux) for Linux, such as\n``` bash\nsudo tee /etc/udev/rules.d/11-panda.rules \u003c\u003cEOF\nSUBSYSTEM==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"df11\", MODE=\"0666\"\nSUBSYSTEM==\"usb\", ATTRS{idVendor}==\"3801\", ATTRS{idProduct}==\"ddcc\", MODE=\"0666\"\nSUBSYSTEM==\"usb\", ATTRS{idVendor}==\"3801\", ATTRS{idProduct}==\"ddee\", MODE=\"0666\"\nSUBSYSTEM==\"usb\", ATTRS{idVendor}==\"bbaa\", ATTRS{idProduct}==\"ddcc\", MODE=\"0666\"\nSUBSYSTEM==\"usb\", ATTRS{idVendor}==\"bbaa\", ATTRS{idProduct}==\"ddee\", MODE=\"0666\"\nEOF\nsudo udevadm control --reload-rules \u0026\u0026 sudo udevadm trigger\n```\n\nThe panda jungle uses different udev rules. See [the repo](https://github.com/commaai/panda_jungle#udev-rules) for instructions.\n\n## Software interface support\n\nAs a universal car interface, it should support every reasonable software interface.\n\n- [Python library](https://github.com/commaai/panda/tree/master/python)\n- [C++ library](https://github.com/commaai/openpilot/tree/master/selfdrive/pandad)\n- [socketcan in kernel](https://github.com/commaai/panda/tree/master/drivers/linux) (alpha)\n\n## Licensing\n\npanda software is released under the MIT license unless otherwise specified.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommaai%2Fpanda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommaai%2Fpanda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommaai%2Fpanda/lists"}