From bfbaa34a4dae67054de16393e3c5cdecd2f057df Mon Sep 17 00:00:00 2001 From: Dave Kneeland Date: Wed, 22 Apr 2026 11:37:22 -0700 Subject: [PATCH 1/3] tesla: tune legacy Model 3/Y steer ratio to 10.3 --- opendbc/car/tesla/interface.py | 5 +++++ opendbc/car/tesla/values.py | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/opendbc/car/tesla/interface.py b/opendbc/car/tesla/interface.py index c43baad0881..9c74ae9767b 100644 --- a/opendbc/car/tesla/interface.py +++ b/opendbc/car/tesla/interface.py @@ -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 + # Legacy Model 3/Y use 10.3; Highland (Model 3) and Juniper (Model Y) + # variants identified by FSD14 EPS FW keep 12.0. + 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 diff --git a/opendbc/car/tesla/values.py b/opendbc/car/tesla/values.py index fb0180061a0..f2946ed8beb 100644 --- a/opendbc/car/tesla/values.py +++ b/opendbc/car/tesla/values.py @@ -47,7 +47,7 @@ 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( @@ -55,7 +55,7 @@ class CAR(Platforms): 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( @@ -74,7 +74,8 @@ 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 keep Highland/Juniper at 12.0. FSD_14_FW = { CAR.TESLA_MODEL_3: [ b'TeMYG4_Main_0.0.0 (77),E4HP015.04.5', From 7e45183282c6f61244325ecee8499a9ad2c00a6f Mon Sep 17 00:00:00 2001 From: Dave Kneeland Date: Wed, 22 Apr 2026 15:01:26 -0700 Subject: [PATCH 2/3] safety/tests: align Tesla lateral limits with safety steer ratio --- opendbc/safety/tests/test_tesla.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opendbc/safety/tests/test_tesla.py b/opendbc/safety/tests/test_tesla.py index 8c05a7dd2e3..f3303622c78 100755 --- a/opendbc/safety/tests/test_tesla.py +++ b/opendbc/safety/tests/test_tesla.py @@ -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]} @@ -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()} From d479160095bdb6ffd117fd43be37d76d6a375777 Mon Sep 17 00:00:00 2001 From: Dave Kneeland Date: Mon, 27 Apr 2026 19:34:40 -0700 Subject: [PATCH 3/3] tesla: clarify legacy-only scope for steer ratio tuning --- opendbc/car/tesla/interface.py | 4 ++-- opendbc/car/tesla/values.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/opendbc/car/tesla/interface.py b/opendbc/car/tesla/interface.py index 9c74ae9767b..b7308f558b6 100644 --- a/opendbc/car/tesla/interface.py +++ b/opendbc/car/tesla/interface.py @@ -48,8 +48,8 @@ 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 - # Legacy Model 3/Y use 10.3; Highland (Model 3) and Juniper (Model Y) - # variants identified by FSD14 EPS FW keep 12.0. + # 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 diff --git a/opendbc/car/tesla/values.py b/opendbc/car/tesla/values.py index f2946ed8beb..7df973f0147 100644 --- a/opendbc/car/tesla/values.py +++ b/opendbc/car/tesla/values.py @@ -75,7 +75,8 @@ class CAR(Platforms): ) # Cars with this EPS FW have FSD14 and use TeslaFlags.FSD_14. -# For Model 3/Y steer ratio, this map is used to keep Highland/Juniper at 12.0. +# 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',