From 524cffa19c3c6a0bf7d460a28f814cbf454e917c Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sun, 13 Sep 2026 17:23:07 -0500 Subject: [PATCH] suburban cam --- opendbc_repo/opendbc/car/gm/fingerprints.py | 3 ++ opendbc_repo/opendbc/car/gm/interface.py | 4 +- opendbc_repo/opendbc/car/gm/tests/test_gm.py | 50 ++++++++++++++++++- opendbc_repo/opendbc/car/gm/values.py | 7 ++- opendbc_repo/opendbc/car/tests/routes.py | 1 + .../opendbc/car/torque_data/substitute.toml | 1 + 6 files changed, 62 insertions(+), 4 deletions(-) diff --git a/opendbc_repo/opendbc/car/gm/fingerprints.py b/opendbc_repo/opendbc/car/gm/fingerprints.py index b8e3b54ceb..922d7f849e 100644 --- a/opendbc_repo/opendbc/car/gm/fingerprints.py +++ b/opendbc_repo/opendbc/car/gm/fingerprints.py @@ -213,6 +213,9 @@ FINGERPRINTS.update({ CAR.CADILLAC_ESCALADE_ESV_2019_ASCM: [{**fp, SASCM_ADDRESS: 8} for fp in FINGERPRINTS[CAR.CADILLAC_ESCALADE_ESV_2019]], CAR.CHEVROLET_SUBURBAN: FINGERPRINTS[CAR.CHEVROLET_SUBURBAN_CC], CAR.CHEVROLET_SUBURBAN_ASCM: FINGERPRINTS[CAR.CHEVROLET_SUBURBAN_CC], + CAR.CHEVROLET_SUBURBAN_CAMERA: [ + {**fp, CAMERA_DIAGNOSTIC_ADDRESS: 8, CAMERA_DIAGNOSTIC_RX_ADDRESS: 8} for fp in FINGERPRINTS[CAR.CHEVROLET_SUBURBAN_CC] + ], CAR.GMC_YUKON_CC: FINGERPRINTS[CAR.GMC_YUKON], CAR.CADILLAC_XT6: FINGERPRINTS[CAR.CHEVROLET_TRAVERSE], CAR.CADILLAC_XT5: FINGERPRINTS[CAR.CHEVROLET_TRAVERSE], diff --git a/opendbc_repo/opendbc/car/gm/interface.py b/opendbc_repo/opendbc/car/gm/interface.py index 58e0ac6f54..63df6aa864 100755 --- a/opendbc_repo/opendbc/car/gm/interface.py +++ b/opendbc_repo/opendbc/car/gm/interface.py @@ -306,7 +306,7 @@ class CarInterface(CarInterfaceBase): ret.safetyConfigs[0].safetyParam |= GMSafetyFlags.HW_CAM_LONG.value elif is_camera_acc: - ret.alphaLongitudinalAvailable = (candidate not in CC_ONLY_CAR) and not ret.enableGasInterceptorDEPRECATED + ret.alphaLongitudinalAvailable = candidate not in (CC_ONLY_CAR | ALT_ACCS) and not ret.enableGasInterceptorDEPRECATED ret.networkLocation = NetworkLocation.fwdCamera ret.radarUnavailable = True ret.pcmCruise = not ret.enableGasInterceptorDEPRECATED @@ -522,7 +522,7 @@ class CarInterface(CarInterfaceBase): ret.steerActuatorDelay = 0.2 CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) - elif candidate in (CAR.CHEVROLET_SUBURBAN, CAR.CHEVROLET_SUBURBAN_ASCM, CAR.CHEVROLET_SUBURBAN_CC): + elif candidate in (CAR.CHEVROLET_SUBURBAN, CAR.CHEVROLET_SUBURBAN_ASCM, CAR.CHEVROLET_SUBURBAN_CAMERA, CAR.CHEVROLET_SUBURBAN_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 7dbc306af4..915895990a 100644 --- a/opendbc_repo/opendbc/car/gm/tests/test_gm.py +++ b/opendbc_repo/opendbc/car/gm/tests/test_gm.py @@ -28,7 +28,7 @@ import opendbc.car.gm.interface as gm_interface from opendbc.car.common.conversions import Conversions as CV from opendbc.car.gps import CHEVROLET_BOLT_GPS_CARS, CHEVROLET_BOLT_GPS_MESSAGES, get_car_gps_config, parse_chevrolet_bolt_can_gps from opendbc.car.gm.fingerprints import FINGERPRINTS -from opendbc.car.gm.values import ASCM_INT, CAMERA_ACC_CAR, CAR, CC_ONLY_CAR, DBC, GM_RX_OFFSET, CarControllerParams, CruiseButtons, GMFlags, GMSafetyFlags +from opendbc.car.gm.values import ALT_ACCS, ASCM_INT, CAMERA_ACC_CAR, CAR, CC_ONLY_CAR, DBC, GM_RX_OFFSET, CarControllerParams, CruiseButtons, GMFlags, GMSafetyFlags from opendbc.safety import ALTERNATIVE_EXPERIENCE from openpilot.common.params import Params @@ -308,6 +308,54 @@ class TestGMInterface: assert ascm_params.lateralTuning.torque.latAccelFactor == pytest.approx(obd_params.lateralTuning.torque.latAccelFactor) assert ascm_params.lateralTuning.torque.friction == pytest.approx(obd_params.lateralTuning.torque.friction) + def test_suburban_camera_harness_preserves_stock_acc(self): + fingerprint = _empty_fingerprint() + fingerprint[0] = FINGERPRINTS[CAR.CHEVROLET_SUBURBAN][0].copy() + fingerprint[2] = fingerprint[0].copy() + + assert CAR.CHEVROLET_SUBURBAN_CAMERA in CAMERA_ACC_CAR + assert CAR.CHEVROLET_SUBURBAN_CAMERA in ALT_ACCS + assert CAR.CHEVROLET_SUBURBAN_CAMERA not in CC_ONLY_CAR + assert CAR.CHEVROLET_SUBURBAN_CAMERA not in ASCM_INT + assert all(fp[CAMERA_DIAGNOSTIC_ADDRESS] == 8 for fp in FINGERPRINTS[CAR.CHEVROLET_SUBURBAN_CAMERA]) + assert all(fp[CAMERA_DIAGNOSTIC_ADDRESS + GM_RX_OFFSET] == 8 for fp in FINGERPRINTS[CAR.CHEVROLET_SUBURBAN_CAMERA]) + + camera_params = interfaces[CAR.CHEVROLET_SUBURBAN_CAMERA].get_params( + CAR.CHEVROLET_SUBURBAN_CAMERA, + fingerprint, + [], + alpha_long=True, + is_release=False, + docs=False, + starpilot_toggles=_test_starpilot_toggles(), + ) + + assert camera_params.networkLocation == structs.CarParams.NetworkLocation.fwdCamera + assert camera_params.pcmCruise + assert not camera_params.alphaLongitudinalAvailable + assert not camera_params.openpilotLongitudinalControl + assert camera_params.safetyConfigs[0].safetyParam == GMSafetyFlags.HW_CAM.value + + def test_suburban_cc_remains_no_acc_gateway_profile(self): + fingerprint = _empty_fingerprint() + fingerprint[0] = FINGERPRINTS[CAR.CHEVROLET_SUBURBAN_CC][0].copy() + + cc_params = interfaces[CAR.CHEVROLET_SUBURBAN_CC].get_params( + CAR.CHEVROLET_SUBURBAN_CC, + fingerprint, + [], + alpha_long=False, + is_release=False, + docs=False, + starpilot_toggles=_test_starpilot_toggles(), + ) + + assert cc_params.networkLocation == structs.CarParams.NetworkLocation.gateway + assert cc_params.openpilotLongitudinalControl + assert not cc_params.pcmCruise + assert cc_params.safetyConfigs[0].safetyParam & GMSafetyFlags.FLAG_GM_CC_LONG.value + assert cc_params.safetyConfigs[0].safetyParam & GMSafetyFlags.FLAG_GM_NO_ACC.value + def test_lacrosse_obd_and_ascm_integrations_remain_separate(self): obd_params = interfaces[CAR.BUICK_LACROSSE].get_params( CAR.BUICK_LACROSSE, diff --git a/opendbc_repo/opendbc/car/gm/values.py b/opendbc_repo/opendbc/car/gm/values.py index 8bada18ce0..dd5a19823e 100644 --- a/opendbc_repo/opendbc/car/gm/values.py +++ b/opendbc_repo/opendbc/car/gm/values.py @@ -361,6 +361,10 @@ class CAR(Platforms): [GMCarDocs("Chevrolet Suburban Premier ASCM Harness 2016-20", "Adaptive Cruise Control (ACC) & LKAS")], CHEVROLET_SUBURBAN.specs, ) + CHEVROLET_SUBURBAN_CAMERA = GMPlatformConfig( + [GMCarDocs("Chevrolet Suburban Premier Camera Harness 2016-20", "Adaptive Cruise Control (ACC) & LKAS")], + CHEVROLET_SUBURBAN.specs, + ) GMC_YUKON_CC = GMPlatformConfig( [GMCarDocs("GMC Yukon No-ACC 2019-20")], CarSpecs(mass=2541, wheelbase=2.95, steerRatio=16.3, centerToFrontRatio=0.4), @@ -551,6 +555,7 @@ CAMERA_ACC_CAR = { CAR.CHEVROLET_SILVERADO, CAR.CHEVROLET_EQUINOX, CAR.CHEVROLET_TRAILBLAZER, + CAR.CHEVROLET_SUBURBAN_CAMERA, CAR.CHEVROLET_VOLT_CAMERA, CAR.CHEVROLET_BLAZER, CAR.CHEVROLET_TRAX, @@ -558,7 +563,7 @@ CAMERA_ACC_CAR = { } # Alt ASCMActiveCruiseControlStatus -ALT_ACCS = {CAR.GMC_YUKON, CAR.GMC_YUKON_CC} +ALT_ACCS = {CAR.CHEVROLET_SUBURBAN_CAMERA, CAR.GMC_YUKON, CAR.GMC_YUKON_CC} # We're integrated at the Safety Data Gateway Module on these cars SDGM_CAR = { diff --git a/opendbc_repo/opendbc/car/tests/routes.py b/opendbc_repo/opendbc/car/tests/routes.py index d1bf6fa51f..33ab434143 100644 --- a/opendbc_repo/opendbc/car/tests/routes.py +++ b/opendbc_repo/opendbc/car/tests/routes.py @@ -36,6 +36,7 @@ non_tested_cars = [ GM.CHEVROLET_MALIBU_SDGM, GM.CHEVROLET_SUBURBAN, GM.CHEVROLET_SUBURBAN_ASCM, + GM.CHEVROLET_SUBURBAN_CAMERA, GM.CHEVROLET_TRAX, GM.CHEVROLET_VOLT_ASCM, GM.CHEVROLET_VOLT_CAMERA, diff --git a/opendbc_repo/opendbc/car/torque_data/substitute.toml b/opendbc_repo/opendbc/car/torque_data/substitute.toml index 612a0c6daf..7af94bb31c 100644 --- a/opendbc_repo/opendbc/car/torque_data/substitute.toml +++ b/opendbc_repo/opendbc/car/torque_data/substitute.toml @@ -91,6 +91,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "CHEVROLET_MALIBU_ASCM" = "CHEVROLET_VOLT" "CHEVROLET_MALIBU_SDGM" = "CHEVROLET_VOLT" "CHEVROLET_SUBURBAN_ASCM" = "CHEVROLET_SUBURBAN" +"CHEVROLET_SUBURBAN_CAMERA" = "CHEVROLET_SUBURBAN" "HOLDEN_ASTRA" = "CHEVROLET_VOLT" "CHEVROLET_VOLT_CC" = "CHEVROLET_VOLT" "CHEVROLET_VOLT_CAMERA" = "CHEVROLET_VOLT"