Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: CARS.md 2.0 #1286

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9c98560
move this from openpilot
jyoung8607 Sep 25, 2024
af65854
TOML not the right way
jyoung8607 Sep 25, 2024
f818bda
work in progress
jyoung8607 Sep 25, 2024
bae7a80
didn't need that
jyoung8607 Sep 25, 2024
63447ef
cleanup
jyoung8607 Sep 25, 2024
2e310e4
comment cleanup
jyoung8607 Sep 25, 2024
a55c501
checkpoint
jyoung8607 Sep 25, 2024
f85f193
move CARS.md generation to opendbc
jyoung8607 Sep 25, 2024
a7e536b
move assets
jyoung8607 Sep 25, 2024
4f0cf9a
remove extra import
jyoung8607 Sep 25, 2024
b74693e
base path tweaks
jyoung8607 Sep 25, 2024
8ef5dc2
start tweaking template
jyoung8607 Sep 25, 2024
4249fe5
checkpoint
jyoung8607 Sep 25, 2024
0f626ad
more test footnotes
jyoung8607 Sep 26, 2024
701cc5e
add TODO
jyoung8607 Sep 26, 2024
ae9edf9
more TODO
jyoung8607 Sep 26, 2024
fba84ad
Merge branch 'master' of https://github.com/commaai/opendbc into extr…
jyoung8607 Sep 27, 2024
54b7434
move Toyota SecOC cars to CarDocs
jyoung8607 Sep 27, 2024
3fa6b5e
cleanup
jyoung8607 Sep 27, 2024
d682d26
cleanup
jyoung8607 Sep 27, 2024
f81cbe2
template cleanup after Toyota
jyoung8607 Sep 27, 2024
a8124e1
cleanup support types
jyoung8607 Sep 27, 2024
00a59a1
better structures
jyoung8607 Sep 27, 2024
1fae8e8
whitespace cleanup
jyoung8607 Sep 27, 2024
fac037e
refactor
jyoung8607 Sep 27, 2024
61d1820
display wider?
jyoung8607 Sep 27, 2024
8fa5d58
a bit cleaner
jyoung8607 Sep 27, 2024
59cc222
more refactor/cleanup
jyoung8607 Sep 27, 2024
bab134a
didn't work
jyoung8607 Sep 27, 2024
bea45be
maybe maybe maybe
jyoung8607 Sep 27, 2024
bbba7fb
maybe maybe maybe maybe
jyoung8607 Sep 27, 2024
c82b635
maybe maybe maybe maybe maybe
jyoung8607 Sep 27, 2024
5747bf9
don't need those anymore
jyoung8607 Sep 28, 2024
d407041
finally
jyoung8607 Sep 28, 2024
71c693c
cleanup
jyoung8607 Sep 28, 2024
7fe8e27
whitespace
jyoung8607 Sep 28, 2024
71d7b67
support info links
jyoung8607 Sep 28, 2024
cef5cc0
remove footnotes now that we have links
jyoung8607 Sep 28, 2024
501fe8f
ditch the other footnotes
jyoung8607 Sep 28, 2024
7c05bba
more Ford dashcam info
jyoung8607 Sep 28, 2024
b148854
Merge branch 'master' of https://github.com/commaai/opendbc into extr…
jyoung8607 Sep 28, 2024
07c8e77
regen CARS.md
jyoung8607 Sep 28, 2024
6d9771d
dashcam reason link for VW PQ
jyoung8607 Sep 28, 2024
ef3a7b4
Merge branch 'master' of https://github.com/commaai/opendbc into extr…
jyoung8607 Oct 2, 2024
a35a129
typing fixes
jyoung8607 Oct 2, 2024
9ff2e16
Revert "move assets"
jyoung8607 Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions opendbc/car/CARS_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{% set footnote_tag = '[<sup>{}</sup>](#footnotes)' %}
{% set star_icon = '[![star](assets/icon-star-{}.svg)](##)' %}
{% set video_icon = '<a href="{}" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>' %}
{# Force hardware column wider by using a blank image with max width. #}
{% set width_tag = '<a href="##"><img width=2000></a>%s<br>&nbsp;' %}
{% set hardware_col_name = 'Hardware Needed' %}
{% set wide_hardware_col_name = width_tag|format(hardware_col_name) -%}

<!--- AUTOGENERATED FROM selfdrive/car/CARS_template.md, DO NOT EDIT. --->

# Car Info

A supported vehicle is one that just works when you install a comma device. All supported cars provide a better experience than any stock system. Supported vehicles reference the US market unless otherwise specified.

# {{all_car_docs | length}} Known Cars with Supportability Info

<div style="width: 1500px">

|{{Column | map(attribute='value') | join('|') | replace(hardware_col_name, wide_hardware_col_name)}}|
|---|---|---|{% for _ in range((Column | length) - 3) %}{{':---:|'}}{% endfor +%}
{% for car_docs in all_car_docs %}
|{% for column in Column %}{{car_docs.get_column(column, star_icon, video_icon, footnote_tag)}}|{% endfor %}

{% endfor %}

</div>

### Footnotes
{% for footnote in footnotes %}
<sup>{{loop.index}}</sup>{{footnote}} <br />
{% endfor %}

## Community Maintained Cars
Although they're not upstream, the community has openpilot running on other makes and models. See the 'Community Supported Models' section of each make [on our wiki](https://wiki.comma.ai/).

# Don't see your car here?

**openpilot can support many more cars than it currently does.** There are a few reasons your car may not be supported.
If your car doesn't fit into any of the incompatibility criteria here, then there's a good chance it can be supported! We're adding support for new cars all the time. **We don't have a roadmap for car support**, and in fact, most car support comes from users like you!

### Which cars are able to be supported?

openpilot uses the existing steering, gas, and brake interfaces in your car. If your car lacks any one of these interfaces, openpilot will not be able to control the car. If your car has [ACC](https://en.wikipedia.org/wiki/Adaptive_cruise_control) and any form of [LKAS](https://en.wikipedia.org/wiki/Automated_Lane_Keeping_Systems)/[LCA](https://en.wikipedia.org/wiki/Lane_centering), then it almost certainly has these interfaces. These features generally started shipping on cars around 2016. Note that manufacturers will often make their own [marketing terms](https://en.wikipedia.org/wiki/Adaptive_cruise_control#Vehicle_models_supporting_adaptive_cruise_control) for these features, such as Hyundai's "Smart Cruise Control" branding of Adaptive Cruise Control.

If your car has the following packages or features, then it's a good candidate for support.

| Make | Required Package/Features |
| ---- | ------------------------- |
| Acura | Any car with AcuraWatch Plus will work. AcuraWatch Plus comes standard on many newer models. |
| Ford | Any car with Lane Centering will likely work. |
| Honda | Any car with Honda Sensing will work. Honda Sensing comes standard on many newer models. |
| Subaru | Any car with EyeSight will work. EyeSight comes standard on many newer models. |
| Nissan | Any car with ProPILOT will likely work. |
| Toyota & Lexus | Any car that has Toyota/Lexus Safety Sense with "Lane Departure Alert with Steering Assist (LDA w/SA)" and/or "Lane Tracing Assist (LTA)" will work. Note that LDA without Steering Assist will not work. These features come standard on most newer models. |
| Hyundai, Kia, & Genesis | Any car with Smart Cruise Control (SCC) and Lane Following Assist (LFA) or Lane Keeping Assist (LKAS) will work. LKAS/LFA comes standard on most newer models. Any form of SCC will work, such as NSCC. |
| Chrysler, Jeep, & Ram | Any car with LaneSense and Adaptive Cruise Control will likely work. These come standard on many newer models. |

### FlexRay

All the cars that openpilot supports use a [CAN bus](https://en.wikipedia.org/wiki/CAN_bus) for communication between all the car's computers, however a CAN bus isn't the only way that the computers in your car can communicate. Most, if not all, vehicles from the following manufacturers use [FlexRay](https://en.wikipedia.org/wiki/FlexRay) instead of a CAN bus: **BMW, Mercedes, Audi, Land Rover, and some Volvo**. These cars may one day be supported, but we have no immediate plans to support FlexRay.

### Toyota Security

openpilot does not yet support these Toyota models due to a new message authentication method.
[Vote](https://comma.ai/shop#toyota-security) if you'd like to see openpilot support on these models.
11 changes: 9 additions & 2 deletions opendbc/car/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from collections import namedtuple
from dataclasses import dataclass
from enum import IntFlag, ReprEnum, EnumType
from dataclasses import replace
from dataclasses import replace, field

from panda import uds
from opendbc.car import structs
from opendbc.car.can_definitions import CanData
from opendbc.car.docs_definitions import CarDocs
from opendbc.car.docs_definitions import CarDocs, OtherCarDocs
from opendbc.car.common.numpy_fast import clip, interp

# set up logging
Expand Down Expand Up @@ -321,3 +321,10 @@ def create_dbc_map(cls) -> dict[str, DbcDict]:
@classmethod
def with_flags(cls, flags: IntFlag) -> set['Platforms']:
return {p for p in cls if p.config.flags & flags}


@dataclass(order=True)
class OtherPlatformConfig(PlatformConfig):
car_docs: list[OtherCarDocs]
specs: CarSpecs | None = None
dbc_dict: DbcDict = field(default_factory=lambda: dbc_dict('unknown', None))
37 changes: 30 additions & 7 deletions opendbc/car/docs.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
#!/usr/bin/env python3
import argparse
from collections import defaultdict
import jinja2
from enum import Enum
from natsort import natsorted
import os

from opendbc.car import gen_empty_fingerprint
from opendbc.car.structs import CarParams
from opendbc.car.docs_definitions import CarDocs, Column, CommonFootnote, PartType
from opendbc.car.car_helpers import interfaces, get_interface_attr
from opendbc.car.values import PLATFORMS
from opendbc.car.values import DOC_PLATFORMS
from opendbc.car.mock.values import CAR as MOCK


# TODO: does opendbc need its own version of openpilot.common.basedir?
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../"))
CARS_MD_OUT = os.path.join(BASEDIR, "opendbc", "car", "docs", "CARS.md")
CARS_MD_TEMPLATE = os.path.join(BASEDIR, "opendbc", "car", "CARS_template.md")


def get_all_footnotes() -> dict[Enum, int]:
Expand All @@ -20,14 +30,14 @@ def get_all_footnotes() -> dict[Enum, int]:
def get_all_car_docs() -> list[CarDocs]:
all_car_docs: list[CarDocs] = []
footnotes = get_all_footnotes()
for model, platform in PLATFORMS.items():
for model, platform in DOC_PLATFORMS.items():
car_docs = platform.config.car_docs
# If available, uses experimental longitudinal limits for the docs
CP = interfaces[model][0].get_params(platform, fingerprint=gen_empty_fingerprint(),
car_fw=[CarParams.CarFw(ecu=CarParams.Ecu.unknown)], experimental_long=True, docs=True)

if CP.dashcamOnly or not len(car_docs):
if not len(car_docs):
continue
cp_model, cp_platform = (model, platform) if model in interfaces else ("MOCK", MOCK.MOCK)
# If available, uses experimental longitudinal limits for the docs
CP = interfaces[cp_model][0].get_params(cp_platform, fingerprint=gen_empty_fingerprint(),
car_fw=[CarParams.CarFw(ecu=CarParams.Ecu.unknown)], experimental_long=True, docs=True)

# A platform can include multiple car models
for _car_docs in car_docs:
Expand Down Expand Up @@ -57,3 +67,16 @@ def generate_cars_md(all_car_docs: list[CarDocs], template_fn: str) -> str:
group_by_make=group_by_make, footnotes=footnotes,
Column=Column)
return cars_md


if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Auto generates supported cars documentation",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("--template", default=CARS_MD_TEMPLATE, help="Override default template filename")
parser.add_argument("--out", default=CARS_MD_OUT, help="Override default generated filename")
args = parser.parse_args()

with open(args.out, 'w') as f:
f.write(generate_cars_md(get_all_car_docs(), args.template))
print(f"Generated and written to {args.out}")
Loading
Loading