diff --git a/opendbc/car/tesla/interface.py b/opendbc/car/tesla/interface.py index c43baad0881..b7308f558b6 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 + # 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 diff --git a/opendbc/car/tesla/values.py b/opendbc/car/tesla/values.py index fb0180061a0..7df973f0147 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,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', 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()}