Skip to content

Commit

Permalink
add model years and TeslaCarDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasloetkolben committed Jan 14, 2025
1 parent 43168b3 commit 11ed4f0
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions opendbc/car/tesla/values.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
from dataclasses import dataclass, field
from enum import IntFlag
from opendbc.car.structs import CarParams
from opendbc.car import Bus, structs
from opendbc.car import AngleRateLimit, CarSpecs, PlatformConfig, Platforms
from opendbc.car.structs import CarParams, CarState
from opendbc.car import Bus, CarSpecs, DbcDict, PlatformConfig, Platforms, AngleRateLimit
from opendbc.car.docs_definitions import CarDocs
from opendbc.car.fw_query_definitions import FwQueryConfig, Request, StdQueries

Ecu = CarParams.Ecu

@dataclass
class TeslaCarDocs(CarDocs):
package: str = "Traffic Aware Cruise Control"

@dataclass
class TeslaPlatformConfig(PlatformConfig):
dbc_dict: DbcDict = field(default_factory=lambda: {Bus.party: 'tesla_model3_party'})

class CAR(Platforms):
TESLA_MODEL_3 = PlatformConfig(
[CarDocs("Tesla Model 3", "All")],
TESLA_MODEL_3 = TeslaPlatformConfig(
[TeslaCarDocs("Tesla Model 3 2019-2024")],
CarSpecs(mass=1899., wheelbase=2.875, steerRatio=12.0),
{Bus.party: 'tesla_model3_party'},
)
TESLA_MODEL_Y = PlatformConfig(
[CarDocs("Tesla Model Y", "All")],
TESLA_MODEL_Y = TeslaPlatformConfig(
[TeslaCarDocs("Tesla Model Y 2020-2024")],
CarSpecs(mass=2072., wheelbase=2.890, steerRatio=12.0),
{Bus.party: 'tesla_model3_party'},
)


Expand All @@ -40,12 +45,12 @@ class CANBUS:


GEAR_MAP = {
"DI_GEAR_INVALID": structs.CarState.GearShifter.unknown,
"DI_GEAR_P": structs.CarState.GearShifter.park,
"DI_GEAR_R": structs.CarState.GearShifter.reverse,
"DI_GEAR_N": structs.CarState.GearShifter.neutral,
"DI_GEAR_D": structs.CarState.GearShifter.drive,
"DI_GEAR_SNA": structs.CarState.GearShifter.unknown,
"DI_GEAR_INVALID": CarState.GearShifter.unknown,
"DI_GEAR_P": CarState.GearShifter.park,
"DI_GEAR_R": CarState.GearShifter.reverse,
"DI_GEAR_N": CarState.GearShifter.neutral,
"DI_GEAR_D": CarState.GearShifter.drive,
"DI_GEAR_SNA": CarState.GearShifter.unknown,
}

class CarControllerParams:
Expand Down

0 comments on commit 11ed4f0

Please sign in to comment.