mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-20 13:32:04 +08:00
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from cereal import car
|
||||
from panda import Panda
|
||||
from openpilot.selfdrive.car.tesla.values import CANBUS, CAR
|
||||
from openpilot.selfdrive.car.tesla.values import CANBUS
|
||||
from openpilot.selfdrive.car import get_safety_config
|
||||
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
|
||||
|
||||
@@ -41,14 +41,6 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.steerLimitTimer = 1.0
|
||||
ret.steerActuatorDelay = 0.25
|
||||
|
||||
if candidate in (CAR.AP2_MODELS, CAR.AP1_MODELS):
|
||||
ret.mass = 2100.
|
||||
ret.wheelbase = 2.959
|
||||
ret.centerToFront = ret.wheelbase * 0.5
|
||||
ret.steerRatio = 15.0
|
||||
else:
|
||||
raise ValueError(f"Unsupported car: {candidate}")
|
||||
|
||||
return ret
|
||||
|
||||
def _update(self, c):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from collections import namedtuple
|
||||
from enum import StrEnum
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from cereal import car
|
||||
from openpilot.selfdrive.car import AngleRateLimit, dbc_dict
|
||||
from openpilot.selfdrive.car import AngleRateLimit, CarSpecs, DbcDict, PlatformConfig, Platforms, dbc_dict
|
||||
from openpilot.selfdrive.car.docs_definitions import CarInfo
|
||||
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries
|
||||
|
||||
@@ -11,22 +11,24 @@ Ecu = car.CarParams.Ecu
|
||||
Button = namedtuple('Button', ['event_type', 'can_addr', 'can_msg', 'values'])
|
||||
|
||||
|
||||
class CAR(StrEnum):
|
||||
AP1_MODELS = 'TESLA AP1 MODEL S'
|
||||
AP2_MODELS = 'TESLA AP2 MODEL S'
|
||||
@dataclass
|
||||
class TeslaPlatformConfig(PlatformConfig):
|
||||
dbc_dict: DbcDict = field(default_factory=lambda: dbc_dict('tesla_powertrain', 'tesla_radar', chassis_dbc='tesla_can'))
|
||||
|
||||
|
||||
CAR_INFO: dict[str, CarInfo | list[CarInfo]] = {
|
||||
CAR.AP1_MODELS: CarInfo("Tesla AP1 Model S", "All"),
|
||||
CAR.AP2_MODELS: CarInfo("Tesla AP2 Model S", "All"),
|
||||
}
|
||||
class CAR(Platforms):
|
||||
AP1_MODELS = TeslaPlatformConfig(
|
||||
'TESLA AP1 MODEL S',
|
||||
CarInfo("Tesla AP1 Model S", "All"),
|
||||
specs=CarSpecs(mass=2100., wheelbase=2.959, steerRatio=15.0)
|
||||
)
|
||||
AP2_MODELS = TeslaPlatformConfig(
|
||||
'TESLA AP2 MODEL S',
|
||||
CarInfo("Tesla AP2 Model S", "All"),
|
||||
specs=AP1_MODELS.specs
|
||||
)
|
||||
|
||||
|
||||
DBC = {
|
||||
CAR.AP2_MODELS: dbc_dict('tesla_powertrain', 'tesla_radar', chassis_dbc='tesla_can'),
|
||||
CAR.AP1_MODELS: dbc_dict('tesla_powertrain', 'tesla_radar', chassis_dbc='tesla_can'),
|
||||
}
|
||||
|
||||
FW_QUERY_CONFIG = FwQueryConfig(
|
||||
requests=[
|
||||
Request(
|
||||
@@ -88,3 +90,7 @@ class CarControllerParams:
|
||||
|
||||
def __init__(self, CP):
|
||||
pass
|
||||
|
||||
|
||||
CAR_INFO = CAR.create_carinfo_map()
|
||||
DBC = CAR.create_dbc_map()
|
||||
|
||||
Reference in New Issue
Block a user