From 9b530d520c912f0c658c184440af1339a3ab8bc5 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Wed, 27 May 2026 21:37:23 -0500 Subject: [PATCH] XT5 --- opendbc_repo/opendbc/car/gm/interface.py | 2 +- opendbc_repo/opendbc/car/gm/tests/test_gm.py | 24 +++++++++++++++++++ opendbc_repo/opendbc/car/gm/values.py | 7 +++++- opendbc_repo/opendbc/car/hyundai/interface.py | 5 +++- .../opendbc/car/hyundai/tests/test_hyundai.py | 16 ++++++++++++- opendbc_repo/opendbc/car/tests/routes.py | 1 + .../opendbc/car/torque_data/substitute.toml | 1 + 7 files changed, 52 insertions(+), 4 deletions(-) diff --git a/opendbc_repo/opendbc/car/gm/interface.py b/opendbc_repo/opendbc/car/gm/interface.py index e0ad84630..dacec0508 100755 --- a/opendbc_repo/opendbc/car/gm/interface.py +++ b/opendbc_repo/opendbc/car/gm/interface.py @@ -489,7 +489,7 @@ class CarInterface(CarInterfaceBase): ret.minSteerSpeed = 7 * CV.MPH_TO_MS CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) - elif candidate == CAR.CADILLAC_XT5_CC: + elif candidate in (CAR.CADILLAC_XT5, CAR.CADILLAC_XT5_CC): ret.steerActuatorDelay = 0.2 CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) diff --git a/opendbc_repo/opendbc/car/gm/tests/test_gm.py b/opendbc_repo/opendbc/car/gm/tests/test_gm.py index af979c5b7..56c7d1de4 100644 --- a/opendbc_repo/opendbc/car/gm/tests/test_gm.py +++ b/opendbc_repo/opendbc/car/gm/tests/test_gm.py @@ -163,6 +163,30 @@ class TestGMInterface: assert car_params.alternativeExperience & ALTERNATIVE_EXPERIENCE.GM_REMAP_CANCEL_TO_DISTANCE assert car_params.safetyConfigs[0].safetyParam & GMSafetyFlags.FLAG_GM_BOLT_2022_PEDAL.value + def test_cadillac_xt5_sdgm_sascm_gates_alpha_long(self): + CarInterface = interfaces[CAR.CADILLAC_XT5] + fingerprint = _empty_fingerprint() + fingerprint[0][0xBE] = 6 + + stock_params = CarInterface.get_params(CAR.CADILLAC_XT5, fingerprint, [], alpha_long=True, is_release=False, + docs=False, starpilot_toggles=_test_starpilot_toggles()) + + assert stock_params.networkLocation == structs.CarParams.NetworkLocation.fwdCamera + assert stock_params.pcmCruise + assert stock_params.alphaLongitudinalAvailable is False + assert stock_params.openpilotLongitudinalControl is False + assert stock_params.safetyConfigs[0].safetyParam & GMSafetyFlags.HW_SDGM.value + + fingerprint[0][0x2FF] = 8 + sascm_params = CarInterface.get_params(CAR.CADILLAC_XT5, fingerprint, [], alpha_long=True, is_release=False, + docs=False, starpilot_toggles=_test_starpilot_toggles()) + + assert sascm_params.flags & GMFlags.SASCM.value + assert sascm_params.alphaLongitudinalAvailable + assert sascm_params.openpilotLongitudinalControl + assert not sascm_params.pcmCruise + assert sascm_params.safetyConfigs[0].safetyParam & GMSafetyFlags.HW_CAM_LONG.value + class TestGMCarController: def test_dash_speed_spoof_respects_live_stock_acc_toggles(self): diff --git a/opendbc_repo/opendbc/car/gm/values.py b/opendbc_repo/opendbc/car/gm/values.py index b1d64c50e..b86e62ad2 100644 --- a/opendbc_repo/opendbc/car/gm/values.py +++ b/opendbc_repo/opendbc/car/gm/values.py @@ -353,6 +353,10 @@ class CAR(Platforms): [GMCarDocs("Cadillac XT4 2023", "Driver Assist Package")], GMCarSpecs(mass=1660, wheelbase=2.78, steerRatio=14.4, centerToFrontRatio=0.4), ) + CADILLAC_XT5 = GMSDGMPlatformConfig( + [GMCarDocs("Cadillac XT5 2022", "Driver Assist Package")], + CarSpecs(mass=1810, wheelbase=2.86, steerRatio=16.34, centerToFrontRatio=0.5), + ) CADILLAC_XT6 = GMPlatformConfig( [GMCarDocs("Cadillac XT6 2020", "Driver Assist Package")], GMCarSpecs(mass=2050, wheelbase=2.86, steerRatio=16.5, centerToFrontRatio=0.4), @@ -383,7 +387,7 @@ class CAR(Platforms): ) CADILLAC_XT5_CC = GMPlatformConfig( [GMCarDocs("Cadillac XT5 - No-ACC")], - CarSpecs(mass=1810, wheelbase=2.86, steerRatio=16.34, centerToFrontRatio=0.5), + CADILLAC_XT5.specs, ) CHEVROLET_EQUINOX_CC = GMPlatformConfig( [GMCarDocs("Chevrolet Equinox 2019-22 - No-ACC")], @@ -527,6 +531,7 @@ ALT_ACCS = {CAR.GMC_YUKON, CAR.GMC_YUKON_CC} # We're integrated at the Safety Data Gateway Module on these cars SDGM_CAR = { CAR.CADILLAC_XT4, + CAR.CADILLAC_XT5, CAR.CADILLAC_XT6, CAR.CHEVROLET_TRAVERSE, CAR.CHEVROLET_BLAZER, diff --git a/opendbc_repo/opendbc/car/hyundai/interface.py b/opendbc_repo/opendbc/car/hyundai/interface.py index 85f38ef6b..09a038b0e 100644 --- a/opendbc_repo/opendbc/car/hyundai/interface.py +++ b/opendbc_repo/opendbc/car/hyundai/interface.py @@ -6,6 +6,7 @@ from opendbc.car.hyundai.values import HyundaiFlags, CAR, CarControllerParams, \ CANFD_SECURITYACCESS_CAR, \ CANFD_RADAR_LIVE_LONGITUDINAL_CAR, \ UNSUPPORTED_LONGITUDINAL_CAR, HyundaiSafetyFlags, \ + HyundaiStarPilotSafetyFlags, \ hyundai_cancel_button_enables_cruise from opendbc.car.hyundai.radar_interface import get_radar_track_config from opendbc.car.interfaces import CarInterfaceBase, ACCEL_MIN @@ -144,7 +145,9 @@ class CarInterface(CarInterfaceBase): if ret.flags & HyundaiFlags.CAMERA_SCC: ret.safetyConfigs[0].safetyParam |= HyundaiSafetyFlags.CAMERA_SCC.value - # These cars have the LFA button on the steering wheel + # These cars expose an LKAS/LFA steering-wheel button that StarPilot can customize. + if 0x391 in fingerprint[0] or ret.flags & HyundaiFlags.CAN_CANFD_BLENDED: + ret.safetyConfigs[-1].safetyParam |= HyundaiStarPilotSafetyFlags.HAS_LDA_BUTTON.value if ret.flags & HyundaiFlags.CAN_CANFD_BLENDED: ret.safetyConfigs[-1].safetyParam |= HyundaiSafetyFlags.CAN_CANFD_BLENDED.value if hyundai_cancel_button_enables_cruise(candidate): diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py b/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py index cdaa5c00c..9daa8fbba 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py @@ -18,7 +18,8 @@ from opendbc.car.hyundai.radar_interface import MRR30_RADAR_START_ADDR, MRR35_RA from opendbc.car.hyundai.values import CAMERA_SCC_CAR, CANFD_CAR, CAN_GEARS, CAR, CHECKSUM, DATE_FW_ECUS, \ HYBRID_CAR, EV_CAR, FW_QUERY_CONFIG, LEGACY_SAFETY_MODE_CAR, CANFD_FUZZY_WHITELIST, \ UNSUPPORTED_LONGITUDINAL_CAR, PLATFORM_CODE_ECUS, HYUNDAI_VERSION_REQUEST_LONG, \ - CarControllerParams, DBC, HyundaiFlags, get_platform_codes, HyundaiSafetyFlags, Buttons + CarControllerParams, DBC, HyundaiFlags, get_platform_codes, HyundaiSafetyFlags, \ + HyundaiStarPilotSafetyFlags, Buttons LongCtrlState = CarControl.Actuators.LongControlState from opendbc.car.hyundai.fingerprints import FW_VERSIONS @@ -229,6 +230,19 @@ class TestHyundaiFingerprint: assert palisade_2023.safetyConfigs[-1].safetyParam & HyundaiSafetyFlags.CAN_CANFD_BLENDED assert palisade_2023.safetyConfigs[-1].safetyParam & HyundaiSafetyFlags.CANCEL_BTN_ENABLE + def test_hyundai_lkas_button_sets_starpilot_safety_flag(self): + fingerprint = gen_empty_fingerprint() + fingerprint[0][0x391] = 8 + + sonata = CarInterface.get_params(CAR.HYUNDAI_SONATA, fingerprint, [], False, False, False, None) + assert sonata.safetyConfigs[-1].safetyParam & HyundaiStarPilotSafetyFlags.HAS_LDA_BUTTON + + sonata_without_lda = CarInterface.get_params(CAR.HYUNDAI_SONATA, gen_empty_fingerprint(), [], False, False, False, None) + assert not (sonata_without_lda.safetyConfigs[-1].safetyParam & HyundaiStarPilotSafetyFlags.HAS_LDA_BUTTON) + + palisade_2023 = CarInterface.get_params(CAR.HYUNDAI_PALISADE_2023, gen_empty_fingerprint(), [], True, False, False, None) + assert palisade_2023.safetyConfigs[-1].safetyParam & HyundaiStarPilotSafetyFlags.HAS_LDA_BUTTON + def test_non_scc_flag_quirks(self): elantra_hev = CarInterface.get_params(CAR.HYUNDAI_ELANTRA_HEV_2022_NON_SCC, gen_empty_fingerprint(), [], True, False, False, None) assert elantra_hev.flags & HyundaiFlags.HYBRID diff --git a/opendbc_repo/opendbc/car/tests/routes.py b/opendbc_repo/opendbc/car/tests/routes.py index 7883e69ea..51ebd5d6b 100644 --- a/opendbc_repo/opendbc/car/tests/routes.py +++ b/opendbc_repo/opendbc/car/tests/routes.py @@ -22,6 +22,7 @@ non_tested_cars = [ MOCK.MOCK, GM.CADILLAC_ATS, GM.CADILLAC_ESCALADE_ASCM, + GM.CADILLAC_XT5, GM.HOLDEN_ASTRA, GM.CHEVROLET_MALIBU, HYUNDAI.GENESIS_G90, diff --git a/opendbc_repo/opendbc/car/torque_data/substitute.toml b/opendbc_repo/opendbc/car/torque_data/substitute.toml index f4096289b..866841c61 100644 --- a/opendbc_repo/opendbc/car/torque_data/substitute.toml +++ b/opendbc_repo/opendbc/car/torque_data/substitute.toml @@ -109,6 +109,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "SUBARU_ASCENT" = "SUBARU_FORESTER" "CADILLAC_CT6_CC" = "CHEVROLET_VOLT" +"CADILLAC_XT5" = "GMC_ACADIA" "CADILLAC_XT5_CC" = "GMC_ACADIA" "BUICK_BABYENCLAVE" = "GMC_ACADIA" "CHEVROLET_EQUINOX_CC" = "CHEVROLET_EQUINOX"