diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index 7f47abbf98..fe4bacd62f 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -1,6 +1,6 @@ # functions common among cars from collections import namedtuple -from dataclasses import dataclass, field +from dataclasses import dataclass from enum import IntFlag, ReprEnum from dataclasses import replace @@ -250,12 +250,12 @@ CarInfos = CarInfo | list[CarInfo] @dataclass(frozen=True, kw_only=True) class CarSpecs: - mass: float + mass: float # kg, curb weight wheelbase: float steerRatio: float - centerToFrontRatio: float = field(default=0.5) - minSteerSpeed: float = field(default=0.) - minEnableSpeed: float = field(default=-1.) + centerToFrontRatio: float = 0.5 + minSteerSpeed: float = 0.0 + minEnableSpeed: float = -1.0 @dataclass(order=True) diff --git a/selfdrive/car/volkswagen/values.py b/selfdrive/car/volkswagen/values.py index 3e4a742224..065a340928 100644 --- a/selfdrive/car/volkswagen/values.py +++ b/selfdrive/car/volkswagen/values.py @@ -112,17 +112,21 @@ class CANBUS: class VolkswagenFlags(IntFlag): STOCK_HCA_PRESENT = 1 + @dataclass class VolkswagenMQBPlatformConfig(PlatformConfig): dbc_dict: DbcDict = field(default_factory=lambda: dbc_dict('vw_mqb_2010', None)) + @dataclass class VolkswagenPQPlatformConfig(PlatformConfig): dbc_dict: DbcDict = field(default_factory=lambda: dbc_dict('vw_golf_mk4', None)) + @dataclass(frozen=True, kw_only=True) class VolkswagenCarSpecs(CarSpecs): - steerRatio: float = field(default=15.6) + steerRatio: float = 15.6 + class Footnote(Enum): KAMIQ = CarFootnote( @@ -158,6 +162,7 @@ class VWCarInfo(CarInfo): if CP.carFingerprint in (CAR.CRAFTER_MK2, CAR.TRANSPORTER_T61): self.car_parts = CarParts([Device.threex_angled_mount, CarHarness.j533]) + # Check the 7th and 8th characters of the VIN before adding a new CAR. If the # chassis code is already listed below, don't add a new CAR, just add to the # FW_VERSIONS for that existing CAR. @@ -353,6 +358,7 @@ class CAR(Platforms): specs=VolkswagenCarSpecs(mass=1505, wheelbase=2.84), ) + PQ_CARS = {CAR.PASSAT_NMS, CAR.SHARAN_MK2} # All supported cars should return FW from the engine, srs, eps, and fwdRadar. Cars