From be4375a3ae496fa99902154cd725a7367c36cbb1 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 5 Mar 2024 15:10:58 -0800 Subject: [PATCH] Platform configs: move tire stiffness into config (#31678) * first one to open PR * mazda * oh it is * fix gm car specs and create MazdaCarSpecs * fix * do honda * ruff old-commit-hash: 638aaa9e53459127a0a1bbd757f85ef1ae16098d --- selfdrive/car/gm/interface.py | 7 ------- selfdrive/car/gm/values.py | 31 +++++++++++++++++------------- selfdrive/car/honda/interface.py | 15 --------------- selfdrive/car/honda/values.py | 33 +++++++++++++++++--------------- selfdrive/car/mazda/interface.py | 1 - selfdrive/car/mazda/values.py | 13 +++++++++---- 6 files changed, 45 insertions(+), 55 deletions(-) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index e0dde4d0e9..76f6a6b0a6 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -145,15 +145,12 @@ class CarInterface(CarInterfaceBase): ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.00]] ret.lateralTuning.pid.kf = 0.00004 # full torque for 20 deg at 80mph means 0.00007818594 ret.steerActuatorDelay = 0.1 # Default delay, not measured yet - ret.tireStiffnessFactor = 0.444 # not optimized yet ret.steerLimitTimer = 0.4 ret.radarTimeStep = 0.0667 # GM radar runs at 15Hz instead of standard 20Hz ret.longitudinalActuatorDelayUpperBound = 0.5 # large delay to initially start braking if candidate == CAR.VOLT: - ret.tireStiffnessFactor = 0.469 # Stock Michelin Energy Saver A/S, LiveParameters - ret.lateralTuning.pid.kpBP = [0., 40.] ret.lateralTuning.pid.kpV = [0., 0.17] ret.lateralTuning.pid.kiBP = [0.] @@ -175,7 +172,6 @@ class CarInterface(CarInterfaceBase): elif candidate in (CAR.ESCALADE_ESV, CAR.ESCALADE_ESV_2019): ret.minEnableSpeed = -1. # engage speed is decided by pcm - ret.tireStiffnessFactor = 1.0 if candidate == CAR.ESCALADE_ESV: ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[10., 41.0], [10., 41.0]] @@ -186,12 +182,10 @@ class CarInterface(CarInterfaceBase): CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) elif candidate == CAR.BOLT_EUV: - ret.tireStiffnessFactor = 1.0 ret.steerActuatorDelay = 0.2 CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) elif candidate == CAR.SILVERADO: - ret.tireStiffnessFactor = 1.0 # On the Bolt, the ECM and camera independently check that you are either above 5 kph or at a stop # with foot on brake to allow engagement, but this platform only has that check in the camera. # TODO: check if this is split by EV/ICE with more platforms in the future @@ -203,7 +197,6 @@ class CarInterface(CarInterfaceBase): CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) elif candidate == CAR.TRAILBLAZER: - ret.tireStiffnessFactor = 1.0 ret.steerActuatorDelay = 0.2 CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index e3414df2bf..bf3c8622c5 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -79,6 +79,11 @@ class GMCarInfo(CarInfo): self.footnotes.append(Footnote.OBD_II) +@dataclass(frozen=True, kw_only=True) +class GMCarSpecs(CarSpecs): + tireStiffnessFactor: float = 0.444 # not optimized yet + + @dataclass class GMPlatformConfig(PlatformConfig): dbc_dict: DbcDict = field(default_factory=lambda: dbc_dict('gm_global_a_powertrain_generated', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis')) @@ -88,47 +93,47 @@ class CAR(Platforms): HOLDEN_ASTRA = GMPlatformConfig( "HOLDEN ASTRA RS-V BK 2017", GMCarInfo("Holden Astra 2017"), - CarSpecs(mass=1363, wheelbase=2.662, steerRatio=15.7, centerToFrontRatio=0.4), + GMCarSpecs(mass=1363, wheelbase=2.662, steerRatio=15.7, centerToFrontRatio=0.4), ) VOLT = GMPlatformConfig( "CHEVROLET VOLT PREMIER 2017", GMCarInfo("Chevrolet Volt 2017-18", min_enable_speed=0, video_link="https://youtu.be/QeMCN_4TFfQ"), - CarSpecs(mass=1607, wheelbase=2.69, steerRatio=17.7, centerToFrontRatio=0.45), + GMCarSpecs(mass=1607, wheelbase=2.69, steerRatio=17.7, centerToFrontRatio=0.45, tireStiffnessFactor=0.469), ) CADILLAC_ATS = GMPlatformConfig( "CADILLAC ATS Premium Performance 2018", GMCarInfo("Cadillac ATS Premium Performance 2018"), - CarSpecs(mass=1601, wheelbase=2.78, steerRatio=15.3), + GMCarSpecs(mass=1601, wheelbase=2.78, steerRatio=15.3), ) MALIBU = GMPlatformConfig( "CHEVROLET MALIBU PREMIER 2017", GMCarInfo("Chevrolet Malibu Premier 2017"), - CarSpecs(mass=1496, wheelbase=2.83, steerRatio=15.8, centerToFrontRatio=0.4), + GMCarSpecs(mass=1496, wheelbase=2.83, steerRatio=15.8, centerToFrontRatio=0.4), ) ACADIA = GMPlatformConfig( "GMC ACADIA DENALI 2018", GMCarInfo("GMC Acadia 2018", video_link="https://www.youtube.com/watch?v=0ZN6DdsBUZo"), - CarSpecs(mass=1975, wheelbase=2.86, steerRatio=14.4, centerToFrontRatio=0.4), + GMCarSpecs(mass=1975, wheelbase=2.86, steerRatio=14.4, centerToFrontRatio=0.4), ) BUICK_LACROSSE = GMPlatformConfig( "BUICK LACROSSE 2017", GMCarInfo("Buick LaCrosse 2017-19", "Driver Confidence Package 2"), - CarSpecs(mass=1712, wheelbase=2.91, steerRatio=15.8, centerToFrontRatio=0.4), + GMCarSpecs(mass=1712, wheelbase=2.91, steerRatio=15.8, centerToFrontRatio=0.4), ) BUICK_REGAL = GMPlatformConfig( "BUICK REGAL ESSENCE 2018", GMCarInfo("Buick Regal Essence 2018"), - CarSpecs(mass=1714, wheelbase=2.83, steerRatio=14.4, centerToFrontRatio=0.4), + GMCarSpecs(mass=1714, wheelbase=2.83, steerRatio=14.4, centerToFrontRatio=0.4), ) ESCALADE = GMPlatformConfig( "CADILLAC ESCALADE 2017", GMCarInfo("Cadillac Escalade 2017", "Driver Assist Package"), - CarSpecs(mass=2564, wheelbase=2.95, steerRatio=17.3), + GMCarSpecs(mass=2564, wheelbase=2.95, steerRatio=17.3), ) ESCALADE_ESV = GMPlatformConfig( "CADILLAC ESCALADE ESV 2016", GMCarInfo("Cadillac Escalade ESV 2016", "Adaptive Cruise Control (ACC) & LKAS"), - CarSpecs(mass=2739, wheelbase=3.302, steerRatio=17.3), + GMCarSpecs(mass=2739, wheelbase=3.302, steerRatio=17.3, tireStiffnessFactor=1.0), ) ESCALADE_ESV_2019 = GMPlatformConfig( "CADILLAC ESCALADE ESV 2019", @@ -141,7 +146,7 @@ class CAR(Platforms): GMCarInfo("Chevrolet Bolt EUV 2022-23", "Premier or Premier Redline Trim without Super Cruise Package", video_link="https://youtu.be/xvwzGMUA210"), GMCarInfo("Chevrolet Bolt EV 2022-23", "2LT Trim with Adaptive Cruise Control Package"), ], - CarSpecs(mass=1669, wheelbase=2.63779, steerRatio=16.8, centerToFrontRatio=0.4), + GMCarSpecs(mass=1669, wheelbase=2.63779, steerRatio=16.8, centerToFrontRatio=0.4, tireStiffnessFactor=1.0), ) SILVERADO = GMPlatformConfig( "CHEVROLET SILVERADO 1500 2020", @@ -149,17 +154,17 @@ class CAR(Platforms): GMCarInfo("Chevrolet Silverado 1500 2020-21", "Safety Package II"), GMCarInfo("GMC Sierra 1500 2020-21", "Driver Alert Package II", video_link="https://youtu.be/5HbNoBLzRwE"), ], - CarSpecs(mass=2450, wheelbase=3.75, steerRatio=16.3), + GMCarSpecs(mass=2450, wheelbase=3.75, steerRatio=16.3, tireStiffnessFactor=1.0), ) EQUINOX = GMPlatformConfig( "CHEVROLET EQUINOX 2019", GMCarInfo("Chevrolet Equinox 2019-22"), - CarSpecs(mass=1588, wheelbase=2.72, steerRatio=14.4, centerToFrontRatio=0.4), + GMCarSpecs(mass=1588, wheelbase=2.72, steerRatio=14.4, centerToFrontRatio=0.4), ) TRAILBLAZER = GMPlatformConfig( "CHEVROLET TRAILBLAZER 2021", GMCarInfo("Chevrolet Trailblazer 2021-22"), - CarSpecs(mass=1345, wheelbase=2.64, steerRatio=16.8, centerToFrontRatio=0.4), + GMCarSpecs(mass=1345, wheelbase=2.64, steerRatio=16.8, centerToFrontRatio=0.4, tireStiffnessFactor=1.0), ) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 9c39c4694f..f791d4b639 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -111,7 +111,6 @@ class CarInterface(CarInterfaceBase): elif candidate == CAR.ACCORD: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.8467 if eps_modified: ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.09]] @@ -120,12 +119,10 @@ class CarInterface(CarInterfaceBase): elif candidate == CAR.ACURA_ILX: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.72 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] elif candidate in (CAR.CRV, CAR.CRV_EU): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 1000], [0, 1000]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.444 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] ret.wheelSpeedFactor = 1.025 @@ -139,28 +136,23 @@ class CarInterface(CarInterfaceBase): else: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.64], [0.192]] - ret.tireStiffnessFactor = 0.677 ret.wheelSpeedFactor = 1.025 elif candidate == CAR.CRV_HYBRID: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.677 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] ret.wheelSpeedFactor = 1.025 elif candidate == CAR.FIT: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.75 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.05]] elif candidate == CAR.FREED: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] - ret.tireStiffnessFactor = 0.75 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.05]] elif candidate in (CAR.HRV, CAR.HRV_3G): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] - ret.tireStiffnessFactor = 0.5 if candidate == CAR.HRV: ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.16], [0.025]] ret.wheelSpeedFactor = 1.025 @@ -168,17 +160,14 @@ class CarInterface(CarInterfaceBase): ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] # TODO: can probably use some tuning elif candidate == CAR.ACURA_RDX: - ret.tireStiffnessFactor = 0.444 ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 1000], [0, 1000]] # TODO: determine if there is a dead zone at the top end ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] elif candidate == CAR.ACURA_RDX_3G: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.06]] - ret.tireStiffnessFactor = 0.677 elif candidate in (CAR.ODYSSEY, CAR.ODYSSEY_CHN): - ret.tireStiffnessFactor = 0.82 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.28], [0.08]] if candidate == CAR.ODYSSEY_CHN: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 32767], [0, 32767]] # TODO: determine if there is a dead zone at the top end @@ -187,22 +176,18 @@ class CarInterface(CarInterfaceBase): elif candidate == CAR.PILOT: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.444 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.38], [0.11]] elif candidate == CAR.RIDGELINE: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.444 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.38], [0.11]] elif candidate == CAR.INSIGHT: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.82 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] elif candidate == CAR.HONDA_E: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - ret.tireStiffnessFactor = 0.82 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] # TODO: can probably use some tuning else: diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index a6b7d26567..4bcbf00735 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -117,7 +117,8 @@ class CAR(Platforms): HondaCarInfo("Honda Inspire 2018", "All", min_steer_speed=3. * CV.MPH_TO_MS), HondaCarInfo("Honda Accord Hybrid 2018-22", "All", min_steer_speed=3. * CV.MPH_TO_MS), ], - CarSpecs(mass=3279 * CV.LB_TO_KG, wheelbase=2.83, steerRatio=16.33, centerToFrontRatio=0.39), # steerRatio: 11.82 is spec end-to-end + # steerRatio: 11.82 is spec end-to-end + CarSpecs(mass=3279 * CV.LB_TO_KG, wheelbase=2.83, steerRatio=16.33, centerToFrontRatio=0.39, tireStiffnessFactor=0.8467), dbc_dict('honda_accord_2018_can_generated', None), ) CIVIC_BOSCH = HondaBoschPlatformConfig( @@ -149,40 +150,42 @@ class CAR(Platforms): CRV_5G = HondaBoschPlatformConfig( "HONDA CR-V 2017", HondaCarInfo("Honda CR-V 2017-22", min_steer_speed=12. * CV.MPH_TO_MS), - CarSpecs(mass=3410 * CV.LB_TO_KG, wheelbase=2.66, steerRatio=16.0, centerToFrontRatio=0.41), # steerRatio: 12.3 is spec end-to-end + # steerRatio: 12.3 is spec end-to-end + CarSpecs(mass=3410 * CV.LB_TO_KG, wheelbase=2.66, steerRatio=16.0, centerToFrontRatio=0.41, tireStiffnessFactor=0.677), dbc_dict('honda_crv_ex_2017_can_generated', None, body_dbc='honda_crv_ex_2017_body_generated'), flags=HondaFlags.BOSCH_ALT_BRAKE, ) CRV_HYBRID = HondaBoschPlatformConfig( "HONDA CR-V HYBRID 2019", HondaCarInfo("Honda CR-V Hybrid 2017-20", min_steer_speed=12. * CV.MPH_TO_MS), - CarSpecs(mass=1667, wheelbase=2.66, steerRatio=16, centerToFrontRatio=0.41), # mass: mean of 4 models in kg, steerRatio: 12.3 is spec end-to-end + # mass: mean of 4 models in kg, steerRatio: 12.3 is spec end-to-end + CarSpecs(mass=1667, wheelbase=2.66, steerRatio=16, centerToFrontRatio=0.41, tireStiffnessFactor=0.677), dbc_dict('honda_accord_2018_can_generated', None), ) HRV_3G = HondaBoschPlatformConfig( "HONDA HR-V 2023", HondaCarInfo("Honda HR-V 2023", "All"), - CarSpecs(mass=3125 * CV.LB_TO_KG, wheelbase=2.61, steerRatio=15.2, centerToFrontRatio=0.41), + CarSpecs(mass=3125 * CV.LB_TO_KG, wheelbase=2.61, steerRatio=15.2, centerToFrontRatio=0.41, tireStiffnessFactor=0.5), dbc_dict('honda_civic_ex_2022_can_generated', None), flags=HondaFlags.BOSCH_RADARLESS | HondaFlags.BOSCH_ALT_BRAKE, ) ACURA_RDX_3G = HondaBoschPlatformConfig( "ACURA RDX 2020", HondaCarInfo("Acura RDX 2019-22", "All", min_steer_speed=3. * CV.MPH_TO_MS), - CarSpecs(mass=4068 * CV.LB_TO_KG, wheelbase=2.75, steerRatio=11.95, centerToFrontRatio=0.41), # as spec + CarSpecs(mass=4068 * CV.LB_TO_KG, wheelbase=2.75, steerRatio=11.95, centerToFrontRatio=0.41, tireStiffnessFactor=0.677), # as spec dbc_dict('acura_rdx_2020_can_generated', None), flags=HondaFlags.BOSCH_ALT_BRAKE, ) INSIGHT = HondaBoschPlatformConfig( "HONDA INSIGHT 2019", HondaCarInfo("Honda Insight 2019-22", "All", min_steer_speed=3. * CV.MPH_TO_MS), - CarSpecs(mass=2987 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=15.0, centerToFrontRatio=0.39), # as spec + CarSpecs(mass=2987 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=15.0, centerToFrontRatio=0.39, tireStiffnessFactor=0.82), # as spec dbc_dict('honda_insight_ex_2019_can_generated', None), ) HONDA_E = HondaBoschPlatformConfig( "HONDA E 2020", HondaCarInfo("Honda e 2020", "All", min_steer_speed=3. * CV.MPH_TO_MS), - CarSpecs(mass=3338.8 * CV.LB_TO_KG, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71), + CarSpecs(mass=3338.8 * CV.LB_TO_KG, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82), dbc_dict('acura_rdx_2020_can_generated', None), ) @@ -190,14 +193,14 @@ class CAR(Platforms): ACURA_ILX = HondaNidecPlatformConfig( "ACURA ILX 2016", HondaCarInfo("Acura ILX 2016-19", "AcuraWatch Plus", min_steer_speed=25. * CV.MPH_TO_MS), - CarSpecs(mass=3095 * CV.LB_TO_KG, wheelbase=2.67, steerRatio=18.61, centerToFrontRatio=0.37), # 15.3 is spec end-to-end + CarSpecs(mass=3095 * CV.LB_TO_KG, wheelbase=2.67, steerRatio=18.61, centerToFrontRatio=0.37, tireStiffnessFactor=0.72), # 15.3 is spec end-to-end dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, ) CRV = HondaNidecPlatformConfig( "HONDA CR-V 2016", HondaCarInfo("Honda CR-V 2015-16", "Touring Trim", min_steer_speed=12. * CV.MPH_TO_MS), - CarSpecs(mass=3572 * CV.LB_TO_KG, wheelbase=2.62, steerRatio=16.89, centerToFrontRatio=0.41), # as spec + CarSpecs(mass=3572 * CV.LB_TO_KG, wheelbase=2.62, steerRatio=16.89, centerToFrontRatio=0.41, tireStiffnessFactor=0.444), # as spec dbc_dict('honda_crv_touring_2016_can_generated', 'acura_ilx_2016_nidec'), flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, ) @@ -211,14 +214,14 @@ class CAR(Platforms): FIT = HondaNidecPlatformConfig( "HONDA FIT 2018", HondaCarInfo("Honda Fit 2018-20", min_steer_speed=12. * CV.MPH_TO_MS), - CarSpecs(mass=2644 * CV.LB_TO_KG, wheelbase=2.53, steerRatio=13.06, centerToFrontRatio=0.39), + CarSpecs(mass=2644 * CV.LB_TO_KG, wheelbase=2.53, steerRatio=13.06, centerToFrontRatio=0.39, tireStiffnessFactor=0.75), dbc_dict('honda_fit_ex_2018_can_generated', 'acura_ilx_2016_nidec'), flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, ) FREED = HondaNidecPlatformConfig( "HONDA FREED 2020", HondaCarInfo("Honda Freed 2020", min_steer_speed=12. * CV.MPH_TO_MS), - CarSpecs(mass=3086. * CV.LB_TO_KG, wheelbase=2.74, steerRatio=13.06, centerToFrontRatio=0.39), # mostly copied from FIT + CarSpecs(mass=3086. * CV.LB_TO_KG, wheelbase=2.74, steerRatio=13.06, centerToFrontRatio=0.39, tireStiffnessFactor=0.75), # mostly copied from FIT dbc_dict('honda_fit_ex_2018_can_generated', 'acura_ilx_2016_nidec'), flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, ) @@ -232,7 +235,7 @@ class CAR(Platforms): ODYSSEY = HondaNidecPlatformConfig( "HONDA ODYSSEY 2018", HondaCarInfo("Honda Odyssey 2018-20"), - CarSpecs(mass=1900, wheelbase=3.0, steerRatio=14.35, centerToFrontRatio=0.41), + CarSpecs(mass=1900, wheelbase=3.0, steerRatio=14.35, centerToFrontRatio=0.41, tireStiffnessFactor=0.82), dbc_dict('honda_odyssey_exl_2018_generated', 'acura_ilx_2016_nidec'), flags=HondaFlags.NIDEC_ALT_PCM_ACCEL, ) @@ -246,7 +249,7 @@ class CAR(Platforms): ACURA_RDX = HondaNidecPlatformConfig( "ACURA RDX 2018", HondaCarInfo("Acura RDX 2016-18", "AcuraWatch Plus", min_steer_speed=12. * CV.MPH_TO_MS), - CarSpecs(mass=3925 * CV.LB_TO_KG, wheelbase=2.68, steerRatio=15.0, centerToFrontRatio=0.38), # as spec + CarSpecs(mass=3925 * CV.LB_TO_KG, wheelbase=2.68, steerRatio=15.0, centerToFrontRatio=0.38, tireStiffnessFactor=0.444), # as spec dbc_dict('acura_rdx_2018_can_generated', 'acura_ilx_2016_nidec'), flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, ) @@ -256,14 +259,14 @@ class CAR(Platforms): HondaCarInfo("Honda Pilot 2016-22", min_steer_speed=12. * CV.MPH_TO_MS), HondaCarInfo("Honda Passport 2019-23", "All", min_steer_speed=12. * CV.MPH_TO_MS), ], - CarSpecs(mass=4278 * CV.LB_TO_KG, wheelbase=2.86, centerToFrontRatio=0.428, steerRatio=16.0), # as spec + CarSpecs(mass=4278 * CV.LB_TO_KG, wheelbase=2.86, centerToFrontRatio=0.428, steerRatio=16.0, tireStiffnessFactor=0.444), # as spec dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, ) RIDGELINE = HondaNidecPlatformConfig( "HONDA RIDGELINE 2017", HondaCarInfo("Honda Ridgeline 2017-24", min_steer_speed=12. * CV.MPH_TO_MS), - CarSpecs(mass=4515 * CV.LB_TO_KG, wheelbase=3.18, centerToFrontRatio=0.41, steerRatio=15.59), # as spec + CarSpecs(mass=4515 * CV.LB_TO_KG, wheelbase=3.18, centerToFrontRatio=0.41, steerRatio=15.59, tireStiffnessFactor=0.444), # as spec dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, ) diff --git a/selfdrive/car/mazda/interface.py b/selfdrive/car/mazda/interface.py index a138318b1a..85be0166ce 100755 --- a/selfdrive/car/mazda/interface.py +++ b/selfdrive/car/mazda/interface.py @@ -20,7 +20,6 @@ class CarInterface(CarInterfaceBase): ret.steerActuatorDelay = 0.1 ret.steerLimitTimer = 0.8 - ret.tireStiffnessFactor = 0.70 # not optimized yet CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) diff --git a/selfdrive/car/mazda/values.py b/selfdrive/car/mazda/values.py index f45e80c119..d8f5aa85dd 100644 --- a/selfdrive/car/mazda/values.py +++ b/selfdrive/car/mazda/values.py @@ -32,6 +32,11 @@ class MazdaCarInfo(CarInfo): car_parts: CarParts = field(default_factory=CarParts.common([CarHarness.mazda])) +@dataclass(frozen=True, kw_only=True) +class MazdaCarSpecs(CarSpecs): + tireStiffnessFactor: float = 0.7 # not optimized yet + + class MazdaFlags(IntFlag): # Static flags # Gen 1 hardware: same CAN messages and same camera @@ -48,22 +53,22 @@ class CAR(Platforms): CX5 = MazdaPlatformConfig( "MAZDA CX-5", MazdaCarInfo("Mazda CX-5 2017-21"), - CarSpecs(mass=3655 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=15.5) + MazdaCarSpecs(mass=3655 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=15.5) ) CX9 = MazdaPlatformConfig( "MAZDA CX-9", MazdaCarInfo("Mazda CX-9 2016-20"), - CarSpecs(mass=4217 * CV.LB_TO_KG, wheelbase=3.1, steerRatio=17.6) + MazdaCarSpecs(mass=4217 * CV.LB_TO_KG, wheelbase=3.1, steerRatio=17.6) ) MAZDA3 = MazdaPlatformConfig( "MAZDA 3", MazdaCarInfo("Mazda 3 2017-18"), - CarSpecs(mass=2875 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=14.0) + MazdaCarSpecs(mass=2875 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=14.0) ) MAZDA6 = MazdaPlatformConfig( "MAZDA 6", MazdaCarInfo("Mazda 6 2017-20"), - CarSpecs(mass=3443 * CV.LB_TO_KG, wheelbase=2.83, steerRatio=15.5) + MazdaCarSpecs(mass=3443 * CV.LB_TO_KG, wheelbase=2.83, steerRatio=15.5) ) CX9_2021 = MazdaPlatformConfig( "MAZDA CX-9 2021",