You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* move safety tests
* move libsafety
* move safety
* rename imports
* copy over needed (minimalized) board and driver code
* dont test safety here
* add new job for safety tests
fix
* try fix
* ubsan
* ?
?
* missing cffi
* should be final fix
* mac fix
* no mac
* use setup script
* no cd
* this is the correct way to do it
* add misra
* misra fixes
* run
* setup misra
* add missing files
* is this used?
* add that
* Revert "is this used?"
This reverts commit 2f34762.
* need this
* misra mutation test
* fix
* no race conditions
* test
* cache cppcheck
fix
* setup
* good timeouts
* mutation test
* fix
* no
* Revert "no"
This reverts commit 39e10a0.
* already tested
* move Safety Model readme section to opendbc
* fix
* fix
* disable mutation tests for merge
* namespace
* test no cache
* 1m
1m
Copy file name to clipboardexpand all lines: README.md
+29-6
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ At its most basic, a car port will control the steering on a car. A "complete" c
69
69
The first step is to get connected to the car with a comma 3X and a car harness.
70
70
The car harness gets you connected to two different CAN buses and splits one of those buses to send our own actuation messages.
71
71
72
-
If you're lucky, a harness compatible with your car will already be designed and sold on comma.ai/shop.
72
+
If you're lucky, a harness compatible with your car will already be designed and sold on comma.ai/shop.
73
73
If you're not so lucky, start with a "developer harness" from comma.ai/shop and crimp on whatever connector you need.
74
74
75
75
### Structure of a port
@@ -78,11 +78,11 @@ Depending on , most of this basic structure will already be in place.
78
78
79
79
The entirery of a car port lives in `opendbc/car/<brand>/`:
80
80
*`carstate.py`: parses out the relevant information from the CAN stream using the car's DBC file
81
-
*`carcontroller.py`: outputs CAN messages to control the car
81
+
*`carcontroller.py`: outputs CAN messages to control the car
82
82
*`<brand>can.py`: thin Python helpers around the DBC file to build CAN messages
83
83
*`fingerprints.py`: database of ECU firmware versions for identifying car models
84
84
*`interface.py`: high level class for interfacing with the car
85
-
*`radar_interface.py`: parses out the radar
85
+
*`radar_interface.py`: parses out the radar
86
86
*`values.py`: enumerates the brand's supported cars
87
87
88
88
### Reverse Engineer CAN messages
@@ -97,7 +97,7 @@ Use the [longitudinal maneuvers](https://github.com/commaai/openpilot/tree/maste
97
97
98
98
## Contributing
99
99
100
-
All opendbc development is coordinated on GitHub and [Discord](https://discord.comma.ai). Check out the `#dev-opendbc-cars` channel and `Vehicle Specific` section.
100
+
All opendbc development is coordinated on GitHub and [Discord](https://discord.comma.ai). Check out the `#dev-opendbc-cars` channel and `Vehicle Specific` section.
101
101
102
102
### Roadmap
103
103
@@ -116,6 +116,29 @@ Longer term
116
116
117
117
Contributions towards anything here are welcome.
118
118
119
+
## Safety Model
120
+
121
+
When a [panda](https://comma.ai/shop/panda) powers up with [opendbc safety firmware](opendbc/safety), 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.
122
+
123
+
Safety modes optionally support `controls_allowed`, which allows or blocks a subset of messages based on a customizable state in the board.
124
+
125
+
## Code Rigor
126
+
127
+
The opendbc safety firmware is written for its use in conjunction with [openpilot](https://github.com/commaai/openpilot) and [panda](https://github.com/commaai/panda). The safety firmware, through its safety model, provides and enforces the
128
+
[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 `safety` folder is held to high standards.
129
+
130
+
These are the [CI regression tests](https://github.com/commaai/opendbc/actions) we have in place:
131
+
* A generic static code analysis is performed by [cppcheck](https://github.com/danmar/cppcheck/).
132
+
* 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](opendbc/safety/tests/misra/coverage_table).
133
+
* Compiler options are relatively strict: the flags `-Wall -Wextra -Wstrict-prototypes -Werror` are enforced.
134
+
* The [safety logic](opendbc/safety) is tested and verified by [unit tests](opendbc/safety/tests) for each supported car variant.
135
+
136
+
The above tests are themselves tested by:
137
+
* a [mutation test](opendbc/safety/tests/misra/test_mutation.py) on the MISRA coverage
138
+
* 100% line coverage enforced on the safety unit tests
139
+
140
+
In addition, we run the [ruff linter](https://github.com/astral-sh/ruff) and [mypy](https://mypy-lang.org/) on the car interface library.
141
+
119
142
### Bounties
120
143
121
144
Every car port is eligible for a bounty:
@@ -137,7 +160,7 @@ In addition to the standard bounties, we also offer higher value bounties for mo
137
160
138
161
***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](https://www.youtube.com/watch?v=FL8CxUSfipM) for an in-depth explanation.
139
162
140
-
***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.
163
+
***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.
141
164
142
165
### Terms
143
166
@@ -163,7 +186,7 @@ In addition to the standard bounties, we also offer higher value bounties for mo
163
186
*[*How to Port a Car*](https://www.youtube.com/watch?v=XxPS5TpTUnI&t=142s&pp=ygUPamFzb24gY29tbWEgY29u) by [@jyoung8607](https://github.com/jyoung8607) from COMMA_CON 2023
164
187
*[commaCarSegments](https://huggingface.co/datasets/commaai/commaCarSegments): a massive dataset of CAN data from 300 different car models
165
188
*[cabana](https://github.com/commaai/openpilot/tree/master/tools/cabana#readme): our tool for reverse engineering CAN messages
166
-
*[can_print_changes.py](https://github.com/commaai/openpilot/blob/master/selfdrive/debug/can_print_changes.py): diff the whole CAN bus across two drives, such as one without any LKAS and one with LKAS
189
+
*[can_print_changes.py](https://github.com/commaai/openpilot/blob/master/selfdrive/debug/can_print_changes.py): diff the whole CAN bus across two drives, such as one without any LKAS and one with LKAS
167
190
*[longitudinal maneuvers](https://github.com/commaai/openpilot/tree/master/tools/longitudinal_maneuvers): a tool for evaluating and tuning longitudinal control
168
191
*[opendbc data](https://commaai.github.io/opendbc-data/): a repository of longitudinal maneuver evaluations
0 commit comments