pip install opendbc 仍在路线图中,需从源码克隆安装;需先装依赖并编译,./test.sh 会执行 pip3 install -e .[testing] 与 scons -j8;panda 上电默认处于 SAFETY_SILENT 模式,需选择安全模式才能发报文,部分模式需自行编译烧录固件。
opendbc
commaaiMIT活跃维护用 Python 读写汽车 CAN 总线报文,内置各车型 DBC 定义,方便做车辆逆向分析和控制。
a Python API for your car
git clone https://github.com/commaai/opendbc.git
cd opendbc
./test.shREADME 未说明运行所需的显存或 CPU 要求;连接实车需 comma four 与对应车 harness,CAN 总线接入使用 panda 硬件。
用 Python 直接控制汽车油门刹车转向并读取车速转向角等状态的车辆接口库
用 Python 读写汽车 CAN 总线报文,内置各车型 DBC 定义,方便做车辆逆向分析和控制。
核心能力
- 用 Python 控制油门、刹车与转向
- 读取车速、转向角等车辆状态
- 解析和构建 DBC 定义的 CAN 报文
- 按品牌组织 carstate/carcontroller 等车端接口
- 内置 safety 固件做功能安全约束
容易踩的坑
- v0.3.1Release 0.3.1最新正式版2026-04-22 · 2026-04-22 08:27 UTC
Ship DBCs, capnp schemas, and torque data in the wheel
- v0.3.0Release 0.3.02026-04-22 · 2026-04-22 07:36 UTC
查看更新说明
Highlights
- Supported car count: 345 → 397
- Tesla Model 3, Model Y, and Model X (HW3 and HW4) support thanks to lukasloetkolben and greatgitsby!
- Rivian R1S and R1T (Gen 1 and Gen 2) support thanks to lukasloetkolben!
- Porsche Macan and Audi Q5 (VW MLB) support thanks to jyoung8607 and Dennis-NL!
- VW MEB (ID.x) architecture support thanks to jyoung8607!
- PSA AEE2010_R3 platform support thanks to elkoled!
- Honda Accord 2023-25, CR-V 2023-25, Pilot 2023-25, Passport 2026, and Acura MDX 2025 support thanks to vanillagorillaa and MVL!
- Honda Odyssey 2021-25 support thanks to csouers and MVL!
- Acura TLX 2021 support thanks to MVL!
- Honda City 2023 support thanks to vanillagorillaa and drFritz!
- Honda N-Box 2018 support thanks to miettal!
- Ford F-150, F-150 Hybrid, Mach-E, and Ranger support
- Ford Escape 2023-24 and Kuga 2024 support thanks to incognitojam!
- Hyundai Nexo 2021 support thanks to sunnyhaibin!
- Kia K7 2017 support thanks to royjr!
- Lexus LS 2018 support thanks to Hacheoy!
- Lexus RC 2023 support thanks to nelsonjchen!
- CANParser and CANPacker rewritten in pure Python — the installed package is pure Python, no compilation required
- Safety code,
isotp.py/ccp.py/xcp.py, andvehicle_model.pymoved into opendbc from panda/openpilot — opendbc is now the self-contained car API package mullreplaced with a faster custom mutation test runner- Safety hardening: per-brand message-block config, missing RX checks, relay-malfunction config
- Rename to SafetyFlags by @sshane in https://github.com/commaai/opendbc/pull/1711
- Move safety constants to opendbc by @sshane in https://github.com/commaai/opendbc/pull/1714
- Missing Safety references by @sshane in https://github.com/commaai/opendbc/pull/1715
- update Volvo V60 signals by @incognitojam in https://github.com/commaai/opendbc/pull/1045
- Revert "Toyota: log gas and brake" by @sshane in https://github.com/commaai/opendbc/pull/1725
- Custom rx sub_addr by @robbederks in https://github.com/commaai/opendbc/pull/1726
- Rivian R1S / R1T Generation 1 by @lukasloetkolben in https://github.com/commaai/opendbc/pull/1613
- Rivian: little fixups by @adeebshihadeh in https://github.com/commaai/opendbc/pull/1728
- Tesla: quicker steering pressed logic by @sshane in https://github.com/commaai/opendbc/pull/1730
- Add Tesla Model 3/Y ignition signal by @sshane in https://github.com/commaai/opendbc/pull/1731
- Tesla: lower steering actuator delay by @sshane in https://github.com/commaai/opendbc/pull/1735
- Tesla: small port cleanup by @sshane in https://github.com/commaai/opendbc/pull/1732
- Tesla: implement cruiseControl.cancel by @sshane in https://github.com/commaai/opendbc/pull/1734
- Rivian: small port cleanup by @sshane in https://github.com/commaai/opendbc/pull/1736
- Tesla: Model 3/Y safety prep by @sshane in https://github.com/commaai/opendbc/pull/1737
- Enable Tesla Model 3/Y behind dashcam by @sshane in https://github.com/commaai/opendbc/pull/1740
- Move some FW query checks into config by @sshane in https://github.com/commaai/opendbc/pull/1743
- remove rj45 cable, duplicate obd-c for obd-ii conn by @greatgitsby in https://github.com/commaai/opendbc/pull/1744
- FW query: sort brands by percentage of ECU matches by @sshane in https://github.com/commaai/opendbc/pull/1742
- Rivian: VIN query by @lukasloetkolben in https://github.com/commaai/opendbc/pull/1739
- uv run is not needed by @sshane in https://github.com/commaai/opendbc/pull/1745
- uv environment setup script by @sshane in https://github.com/commaai/opendbc/pull/1746
- clean up setup.sh by @sshane in https://github.com/commaai/opendbc/pull/1747
- rm all_known_cars by @sshane in https://github.com/commaai/opendbc/pull/1748
- Revert "FW query: sort brands by percentage of ECU matches" by @sshane in https://github.com/commaai/opendbc/pull/1749
- Reapply "FW query: sort brands by percentage of ECU matches
- v0.2.1Release 0.2.12025-02-11 · 2025-02-11 02:03 UTC
查看更新说明
- Fix missing files making car/ package not importable
- v0.2.0Release 0.2.02025-02-11 · 2025-02-11 00:59 UTC
查看更新说明
- Moved car/ directory from openpilot to opendbc. It comprises the APIs necessary to communicate with 275+ car models
- opendbc is moving towards being a complete self-contained car API package
- Soon all opendbc-related tests from openpilot will be migrated as well
- Moved car/ directory from openpilot to opendbc. It comprises the APIs necessary to communicate with 275+ car models
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Most cars since 2016 have electronically-actuatable steering, gas, and brakes thanks to LKAS and ACC. The goal of this project is to support controlling the steering, gas, and brakes on every single one of those cars.
While the primary focus is on supporting ADAS interfaces for openpilot, we're also interested in reading and writing as many things as we can (EV charge status, lock/unlocking doors, etc) such that we can build the best vehicle management app ever.
This README and the supported cars list are all the docs for the opendbc project. Everything you need to know to use, contribute, and extend opendbc are in these docs.
Quick start
git clone https://github.com/commaai/opendbc.git
cd opendbc
# you probably just want to use this. it's an all-in-one for dependency
# installation, compiling, linting, and tests. it's also what runs in CI
./test.sh
# here are the individual commands it runs
pip3 install -e .[testing] # install dependencies
scons -j8 # build with 8 cores
unittest-parallel # run the tests
lefthook run lint # run the linter
examples/ contains small example programs that can read state from the car and control the steering, gas, and brakes.
examples/joystick.py allows you to control a car with a joystick.
Project Structure
opendbc/dbc/is a repository of DBC filesopendbc/can/is a library for parsing and building CAN messages from DBC filesopendbc/car/is a high-level library for interfacing with cars using Pythonopendbc/safety/is the functional safety for all the cars supported byopendbc/car/
How to Port a Car
This guide covers everything from adding support to a new car all the way to improving existing cars (e.g. adding longitudinal control or radar parsing). If similar cars to yours are already compatible, most of this work is likely already done for you.
At its most basic, a car port will control the steering on a car. A "complete" car port will have all of: lateral control, longitudinal control, good tuning for both lateral and longitudinal, radar parsing (if equipped), fuzzy fingerprinting, and more. The new car support docs will clearly communicate each car's support level.
Connect to the Car
The first step is to get connected to the car with a comma four and a car harness. The car harness gets you connected to two different CAN buses and splits one of those buses to send our own actuation messages.
If you're lucky, a harness compatible with your car will already be designed and sold on comma.ai/shop. If you're not so lucky, start with a "developer harness" from comma.ai/shop and crimp on whatever connector you need.
Structure of a port
Depending on the brand, most of this basic structure will already be in place.
The entirety of a car port lives in opendbc/car/<brand>/:
carstate.py: parses out the relevant information from the CAN stream using the car's DBC filecarcontroller.py: outputs CAN messages to control the car<brand>can.py: thin Python helpers around the DBC file to build CAN messagesfingerprints.py: database of ECU firmware versions for identifying car modelsinterface.py: high level class for interfacing with the carradar_interface.py: parses out the radarvalues.py: enumerates the brand's supported cars
Reverse Engineer CAN messages
Start off by recording a route with lots of interesting events: enable LKAS and ACC, turn the steering wheel both extremes, etc. Then, load up that route in cabana.
Tuning
Longitudinal
Use the longitudinal maneuvers report to evaluate your car's longitudinal control and tune it.
Validation
Before submitting a port, go through the car porting checklist.
Contributing
All opendbc development is coordinated on GitHub and Discord. Check out the #dev-opendbc-cars channel and Vehicle Specific section.
Roadmap
Short term
-
pip install opendbc - 100% type coverage
- 100% line coverage
- Make car ports easier: refactors, tools, tests, and docs
- Expose the state of all supported cars better: https://github.com/commaai/opendbc/issues/1144
Longer term
- Extend support to every car with LKAS + ACC interfaces
- Automatic lateral and longitudinal control/tuning evaluation
- Auto-tuning for lateral and longitudinal control
- Automatic Emergency Braking
Contributions towards anything here are welcome.
Safety Model
When a panda powers up with opendbc safety firmware, by default it's in SAFETY_SILENT mode. While in SAFETY_SILENT mode, the CAN buses are forced to be silent. In order to send messages, you have to select a safety mode. Some of safety modes (for example SAFETY_ALLOUTPUT) are disabled in release firmwares. In order to use them, compile and flash your own build.
Safety modes optionally support controls_allowed, which allows or blocks a subset of messages based on a customizable state in the board.
Code Rigor
The opendbc safety firmware is written for its use in conjunction with openpilot and panda. The safety firmware, through its safety model, provides and enforces the
openpilot safety. Due to its critical function, it's important that the application code rigor within the safety folder is held to high standards.
These are the CI regression tests we have in place:
- A generic static code analysis is performed by cppcheck.
- In addition, cppcheck has a specific addon to check for MISRA C:2012 violations. See current coverage.
- Compiler options are relatively strict: the flags
-Wall -Wextra -Wstrict-prototypes -Werrorare enforced. - The safety logic is tested and verified by unit tests for each supported car variant.
The above tests are themselves tested by:
- a mutation test on the MISRA coverage
- 100% line coverage enforced on the safety unit tests
In addition, we run the ruff linter and ty on the car interface library.
Bounties
Every car port is eligible for a bounty:
- $2000 - Any car brand / platform port
- $250 - Any car model port
- $300 - Reverse Engineering a new Actuation Message
In addition to the standard bounties, we also offer higher value bounties for more popular cars. See those at comma.ai/bounties.
FAQ
How do I use this? A comma four is custom-designed to be the best way to run and develop opendbc and openpilot.
Which cars are supported? See the supported cars list.
Can I add support for my car? Yes, most car support comes from the community. Read the guide here.
Which cars can be supported? Any car with LKAS and ACC. More info here.
How does this work? In short, we designed hardware to replace your car's built-in lane keep and adaptive cruise features. See this talk for an in-depth explanation.
Is there a timeline or roadmap for adding car support? No, most car support comes from the community, with comma doing final safety and quality validation. The more complete the community car port is and the more popular the car is, the more likely we are to pick it up as the next one to validate.
Terms
- port: refers to the integration and support of a specific car
- lateral control: aka steering control
- longitudinal control: aka gas/brakes control
- fingerprinting: automatic process for identifying the car
- LKAS: lane keeping assist
- ACC: adaptive cruise control
- harness: car-specific hardware to attach to the car and intercept the ADAS messages
- panda: hardware used to get on a car's CAN bus
- ECU: computers or control modules inside the car
- CAN bus: a bus that connects the ECUs in a car
- cabana: our tool for reverse engineering CAN messages
- DBC file: contains definitions for messages on a CAN bus
- openpilot: an ADAS system for cars supported by opendbc
- comma: the company behind opendbc
- comma four: the hardware used to run openpilot
More resources
- How Do We Control The Car? by @robbederks from COMMA_CON 2021
- How to Port a Car by @jyoung8607 from COMMA_CON 2023
- commaCarSegments: a massive dataset of CAN data from 300 different car models
- cabana: our tool for reverse engineering CAN messages
- can_print_changes.py: diff the whole CAN bus across two drives, such as one without any LKAS and one with LKAS
- longitudinal maneuvers: a tool for evaluating and tuning longitudinal control
- opendbc data: a repository of longitudinal maneuver evaluations
Come work with us -- comma.ai/jobs
comma is hiring engineers to work on opendbc and openpilot. We love hiring contributors.