diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index c8bdccd07..4f42a933c 100644 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -149,7 +149,7 @@ class CarInterface(CarInterfaceBase): ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.noOutput), ret.safetyConfigs[0]] gm_safety_cfg = ret.safetyConfigs[-1] if red_panda else ret.safetyConfigs[0] ret.autoResumeSng = False - ret.enableBsm = 0x142 in fingerprint[CanBus.POWERTRAIN] + ret.enableBsm = 0x142 in fingerprint.get(CanBus.POWERTRAIN, {}) def has_sascm(fingerprint): return 0x2FF in fingerprint.get(CanBus.POWERTRAIN, {}) @@ -158,7 +158,7 @@ class CarInterface(CarInterfaceBase): if has_sascm(fingerprint): ret.flags |= GMFlags.SASCM.value - if PEDAL_MSG in fingerprint[0]: + if PEDAL_MSG in fingerprint.get(CanBus.POWERTRAIN, {}): ret.enableGasInterceptor = True gm_safety_cfg.safetyParam |= Panda.FLAG_GM_GAS_INTERCEPTOR if candidate == CAR.CHEVROLET_BOLT_ACC_2022_2023: @@ -182,14 +182,14 @@ class CarInterface(CarInterfaceBase): if candidate in (CAMERA_ACC_CAR | SDGM_CAR | ASCM_INT) or candidate == CAR.CHEVROLET_VOLT_CAMERA: ret.experimentalLongitudinalAvailable = candidate not in (CC_ONLY_CAR | ASCM_INT | SDGM_CAR) or has_sascm(fingerprint) ret.networkLocation = NetworkLocation.fwdCamera - ret.radarUnavailable = 0x460 not in fingerprint[CanBus.OBSTACLE] + ret.radarUnavailable = 0x460 not in fingerprint.get(CanBus.OBSTACLE, {}) ret.pcmCruise = True ret.minEnableSpeed = 5 * CV.KPH_TO_MS ret.minSteerSpeed = 10 * CV.KPH_TO_MS if candidate in SDGM_CAR: gm_safety_cfg.safetyParam |= Panda.FLAG_GM_HW_SDGM # Use C9 brake bit only on SDGM variants that lack 0xBE (ECMAcceleratorPos) - if ACCELERATOR_POS_MSG not in fingerprint[CanBus.POWERTRAIN]: + if ACCELERATOR_POS_MSG not in fingerprint.get(CanBus.POWERTRAIN, {}): gm_safety_cfg.safetyParam |= Panda.FLAG_GM_FORCE_BRAKE_C9 ret.flags |= GMFlags.FORCE_BRAKE_C9.value ret.minEnableSpeed = -1. # engage speed is decided by pcm @@ -221,7 +221,7 @@ class CarInterface(CarInterfaceBase): else: # ASCM, OBD-II harness ret.openpilotLongitudinalControl = not frogpilot_toggles.disable_openpilot_long ret.networkLocation = NetworkLocation.gateway - ret.radarUnavailable = RADAR_HEADER_MSG not in fingerprint[CanBus.OBSTACLE] and not docs + ret.radarUnavailable = RADAR_HEADER_MSG not in fingerprint.get(CanBus.OBSTACLE, {}) and not docs ret.pcmCruise = False # stock non-adaptive cruise control is kept off # supports stop and go, but initial engage must (conservatively) be above 18mph ret.minEnableSpeed = 18 * CV.MPH_TO_MS @@ -443,11 +443,11 @@ class CarInterface(CarInterfaceBase): gm_safety_cfg.safetyParam |= Panda.FLAG_GM_NO_ACC # Exception for flashed cars, or cars whose camera was removed - if (ret.networkLocation == NetworkLocation.fwdCamera or candidate in CC_ONLY_CAR) and CAM_MSG not in fingerprint[CanBus.CAMERA] and not candidate in (SDGM_CAR | ASCM_INT): + if (ret.networkLocation == NetworkLocation.fwdCamera or candidate in CC_ONLY_CAR) and CAM_MSG not in fingerprint.get(CanBus.CAMERA, {}) and not candidate in (SDGM_CAR | ASCM_INT): ret.flags |= GMFlags.NO_CAMERA.value gm_safety_cfg.safetyParam |= Panda.FLAG_GM_NO_CAMERA - if ACCELERATOR_POS_MSG not in fingerprint[CanBus.POWERTRAIN]: + if ACCELERATOR_POS_MSG not in fingerprint.get(CanBus.POWERTRAIN, {}): ret.flags |= GMFlags.NO_ACCELERATOR_POS_MSG.value return ret