Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions opendbc/car/tesla/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_lo
ret.flags |= TeslaFlags.FSD_14.value
ret.safetyConfigs[0].safetyParam |= TeslaSafetyFlags.FSD_14.value

# This PR only retunes legacy Model 3/Y to 10.3.
# FSD14-identified variants keep the current 12.0 behavior.
if candidate in (CAR.TESLA_MODEL_3, CAR.TESLA_MODEL_Y) and fsd_14:
ret.steerRatio = 12.0

ret.dashcamOnly = candidate in (CAR.TESLA_MODEL_X,) # dashcam only, pending find invalidLkasSetting signal

return ret
8 changes: 5 additions & 3 deletions opendbc/car/tesla/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ class CAR(Platforms):
TeslaCarDocsHW3("Tesla Model 3 (with HW3) 2019-23"),
TeslaCarDocsHW4("Tesla Model 3 (with HW4) 2024-25"),
],
CarSpecs(mass=1899., wheelbase=2.875, steerRatio=12.0),
CarSpecs(mass=1899., wheelbase=2.875, steerRatio=10.3),
{Bus.party: 'tesla_model3_party', Bus.radar: 'tesla_radar_continental_generated'},
)
TESLA_MODEL_Y = TeslaPlatformConfig(
[
TeslaCarDocsHW3("Tesla Model Y (with HW3) 2020-23"),
TeslaCarDocsHW4("Tesla Model Y (with HW4) 2024-25"),
],
CarSpecs(mass=2072., wheelbase=2.890, steerRatio=12.0),
CarSpecs(mass=2072., wheelbase=2.890, steerRatio=10.3),
{Bus.party: 'tesla_model3_party', Bus.radar: 'tesla_radar_continental_generated'},
)
TESLA_MODEL_X = TeslaPlatformConfig(
Expand All @@ -74,7 +74,9 @@ class CAR(Platforms):
]
)

# Cars with this EPS FW have FSD 14 and use TeslaFlags.FSD_14
# Cars with this EPS FW have FSD14 and use TeslaFlags.FSD_14.
# For Model 3/Y steer ratio, this map is used to preserve current 12.0 behavior
# for FSD14-identified variants in this legacy-only tuning change.
FSD_14_FW = {
CAR.TESLA_MODEL_3: [
b'TeMYG4_Main_0.0.0 (77),E4HP015.04.5',
Expand Down
3 changes: 3 additions & 0 deletions opendbc/safety/tests/test_tesla.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def round_angle(apply_angle, can_offset=0):

class TestTeslaSafetyBase(common.CarSafetyTest, common.AngleSteeringSafetyTest, common.LongitudinalAccelSafetyTest):
SAFETY_PARAM = 0
# Keep in sync with opendbc/safety/modes/tesla.h (TESLA_STEERING_PARAMS.steer_ratio)
SAFETY_STEER_RATIO = 12.0

RELAY_MALFUNCTION_ADDRS = {0: (MSG_DAS_steeringControl, MSG_APS_eacMonitor)}
FWD_BLACKLISTED_ADDRS = {2: [MSG_DAS_steeringControl, MSG_APS_eacMonitor]}
Expand Down Expand Up @@ -64,6 +66,7 @@ def _get_steer_cmd_angle_max(self, speed):

def setUp(self):
self.VM = VehicleModel(get_safety_CP())
self.VM.update_params(1.0, self.SAFETY_STEER_RATIO)
self.packer = CANPackerSafety("tesla_model3_party")
self.define = CANDefine("tesla_model3_party")
self.acc_states = {d: v for v, d in self.define.dv["DAS_control"]["DAS_accState"].items()}
Expand Down
Loading