mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-23 01:04:01 +08:00
docs: expose available openpilot longitudinal control (#26312)
* openpilot -> openpilot available * note for dsu cars * common footnotes * Revert "note for dsu cars" - another PR This reverts commit 7f18742fdaaf5f86a1f1caa041b8b027d4b767cf. * space * better? * Update selfdrive/car/docs_definitions.py Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * typo Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: b76829c72550f467447a8a5673dbe442c84dc1f0
This commit is contained in:
@@ -9,12 +9,12 @@ from typing import Dict, List
|
||||
|
||||
from common.basedir import BASEDIR
|
||||
from selfdrive.car import gen_empty_fingerprint
|
||||
from selfdrive.car.docs_definitions import CarInfo, Column
|
||||
from selfdrive.car.docs_definitions import CarInfo, Column, CommonFootnote
|
||||
from selfdrive.car.car_helpers import interfaces, get_interface_attr
|
||||
|
||||
|
||||
def get_all_footnotes() -> Dict[Enum, int]:
|
||||
all_footnotes = []
|
||||
all_footnotes = list(CommonFootnote)
|
||||
for footnotes in get_interface_attr("Footnote", ignore_none=True).values():
|
||||
all_footnotes.extend(footnotes)
|
||||
return {fn: idx + 1 for idx, fn in enumerate(all_footnotes)}
|
||||
@@ -28,7 +28,7 @@ def get_all_car_info() -> List[CarInfo]:
|
||||
all_car_info: List[CarInfo] = []
|
||||
footnotes = get_all_footnotes()
|
||||
for model, car_info in get_interface_attr("CAR_INFO", combine_brands=True).items():
|
||||
CP = interfaces[model][0].get_params(model, fingerprint=gen_empty_fingerprint(), experimental_long=True)
|
||||
CP = interfaces[model][0].get_params(model, fingerprint=gen_empty_fingerprint())
|
||||
|
||||
if CP.dashcamOnly or car_info is None:
|
||||
continue
|
||||
|
||||
@@ -71,6 +71,13 @@ class Harness(Enum):
|
||||
CarFootnote = namedtuple("CarFootnote", ["text", "column"], defaults=[None])
|
||||
|
||||
|
||||
class CommonFootnote(Enum):
|
||||
EXP_LONG_AVAIL = CarFootnote(
|
||||
"Experimental openpilot longitudinal control is available behind a toggle; the toggle is only available in non-release branches such as `master-ci`. " +
|
||||
"Using openpilot longitudinal may disable Automatic Emergency Braking (AEB).",
|
||||
Column.LONGITUDINAL)
|
||||
|
||||
|
||||
def get_footnotes(footnotes: List[Enum], column: Column) -> List[Enum]:
|
||||
# Returns applicable footnotes given current column
|
||||
return [fn for fn in footnotes if fn.value.column == column]
|
||||
@@ -128,11 +135,19 @@ class CarInfo:
|
||||
self.car_name = CP.carName
|
||||
self.car_fingerprint = CP.carFingerprint
|
||||
self.make, self.model, self.years = split_name(self.name)
|
||||
|
||||
op_long = "Stock"
|
||||
if CP.openpilotLongitudinalControl:
|
||||
op_long = "openpilot"
|
||||
elif CP.experimentalLongitudinalAvailable:
|
||||
op_long = "openpilot available"
|
||||
self.footnotes.append(CommonFootnote.EXP_LONG_AVAIL)
|
||||
|
||||
self.row = {
|
||||
Column.MAKE: self.make,
|
||||
Column.MODEL: self.model,
|
||||
Column.PACKAGE: self.package,
|
||||
Column.LONGITUDINAL: "openpilot" if CP.openpilotLongitudinalControl or CP.experimentalLongitudinalAvailable else "Stock",
|
||||
Column.LONGITUDINAL: op_long,
|
||||
Column.FSR_LONGITUDINAL: f"{max(self.min_enable_speed * CV.MS_TO_MPH, 0):.0f} mph",
|
||||
Column.FSR_STEERING: f"{max(self.min_steer_speed * CV.MS_TO_MPH, 0):.0f} mph",
|
||||
Column.STEERING_TORQUE: Star.EMPTY,
|
||||
|
||||
Reference in New Issue
Block a user