From 9abfc02148ea6fa5552f3f1563cf6d5310b73044 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Fri, 19 Nov 2021 05:20:03 -0800 Subject: [PATCH] Hyundai: remove longitudinal whitelist (#22976) * Hyundai: remove longitudinal whitelist * move legacy safety mode into values.py Co-authored-by: Willem Melching --- selfdrive/car/hyundai/interface.py | 9 +++------ selfdrive/car/hyundai/values.py | 3 +++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 2ff9cc1f9a..57b313e534 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -3,7 +3,7 @@ from cereal import car from panda import Panda from common.params import Params from selfdrive.config import Conversions as CV -from selfdrive.car.hyundai.values import CAR, EV_CAR, HYBRID_CAR, Buttons, CarControllerParams +from selfdrive.car.hyundai.values import CAR, EV_CAR, HYBRID_CAR, LEGACY_SAFETY_MODE_CAR, Buttons, CarControllerParams from selfdrive.car.hyundai.radar_interface import RADAR_START_ADDR from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config from selfdrive.car.interfaces import CarInterfaceBase @@ -26,7 +26,7 @@ class CarInterface(CarInterfaceBase): ret.radarOffCan = RADAR_START_ADDR not in fingerprint[1] # WARNING: disabling radar also disables AEB (and we show the same warning on the instrument cluster as if you manually disabled AEB) - ret.openpilotLongitudinalControl = Params().get_bool("DisableRadar") and candidate in [CAR.SONATA, CAR.SONATA_HYBRID, CAR.PALISADE, CAR.SANTA_FE, CAR.ELANTRA_2021, CAR.GENESIS_G70_2020] + ret.openpilotLongitudinalControl = Params().get_bool("DisableRadar") and (candidate not in LEGACY_SAFETY_MODE_CAR) ret.pcmCruise = not ret.openpilotLongitudinalControl @@ -254,10 +254,7 @@ class CarInterface(CarInterfaceBase): ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.16], [0.01]] # these cars require a special panda safety mode due to missing counters and checksums in the messages - if candidate in [CAR.HYUNDAI_GENESIS, CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.IONIQ_PHEV, CAR.IONIQ, CAR.KONA_EV, CAR.KIA_SORENTO, - CAR.SONATA_LF, CAR.KIA_NIRO_EV, CAR.KIA_OPTIMA, CAR.VELOSTER, CAR.KIA_STINGER, - CAR.GENESIS_G70, CAR.GENESIS_G80, CAR.KIA_CEED, CAR.ELANTRA, CAR.IONIQ_HEV_2022]: - assert not ret.openpilotLongitudinalControl # Legacy safety mode doesn't support longitudinal + if candidate in LEGACY_SAFETY_MODE_CAR: ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hyundaiLegacy)] # set appropriate safety param for gas signal diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index e141db25e3..ddcd00ba0c 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -968,6 +968,9 @@ FEATURES = { HYBRID_CAR = set([CAR.IONIQ_PHEV, CAR.ELANTRA_HEV_2021, CAR.KIA_NIRO_HEV, CAR.KIA_NIRO_HEV_2021, CAR.SONATA_HYBRID, CAR.KONA_HEV, CAR.IONIQ, CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022]) # these cars use a different gas signal EV_CAR = set([CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.KIA_NIRO_EV]) +# these cars require a special panda safety mode due to missing counters and checksums in the messages +LEGACY_SAFETY_MODE_CAR = set([CAR.HYUNDAI_GENESIS, CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.IONIQ_PHEV, CAR.IONIQ, CAR.KONA_EV, CAR.KIA_SORENTO, CAR.SONATA_LF, CAR.KIA_NIRO_EV, CAR.KIA_OPTIMA, CAR.VELOSTER, CAR.KIA_STINGER, CAR.GENESIS_G70, CAR.GENESIS_G80, CAR.KIA_CEED, CAR.ELANTRA, CAR.IONIQ_HEV_2022]) + # If 0x500 is present on bus 1 it probably has a Mando radar outputting radar points. # If no points are outputted by default it might be possible to turn it on using selfdrive/debug/hyundai_enable_radar_points.py DBC = {