diff --git a/panda/board/safety/safety_gm.h b/panda/board/safety/safety_gm.h index 069f00335..9dd7554a3 100644 --- a/panda/board/safety/safety_gm.h +++ b/panda/board/safety/safety_gm.h @@ -336,8 +336,7 @@ static int gm_fwd_hook(int bus_num, int addr) { } else { // block lkas message and acc messages if gm_cam_long, forward all others bool is_acc_msg = (addr == 0x315) || (addr == 0x2CB) || (addr == 0x370); - const bool block_pscm = (gm_hw == GM_SDGM) || gm_ascm_int; - block_msg = is_lkas_msg || (is_acc_msg && gm_cam_long) || (block_pscm && (addr == 0x184)); + block_msg = is_lkas_msg || (is_acc_msg && gm_cam_long); } if (!block_msg) { bus_fwd = 0; @@ -391,8 +390,6 @@ static safety_config gm_init(uint16_t param) { } else { ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_CAM_TX_MSGS); } - } else if (gm_hw == GM_SDGM) { - ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_SDGM_TX_MSGS); } return ret; } diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index b023d6946..9c768e9cf 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -39,7 +39,14 @@ class CarState(CarStateBase): ret = car.CarState.new_message() fp_ret = custom.FrogPilotCarState.new_message() volt_like = {CAR.CHEVROLET_VOLT, CAR.CHEVROLET_VOLT_2019, CAR.CHEVROLET_VOLT_ASCM, CAR.CHEVROLET_VOLT_CAMERA, CAR.CHEVROLET_VOLT_CC} - sdgm_non_volt = self.CP.carFingerprint in SDGM_CAR and self.CP.carFingerprint not in volt_like + kaofui_state_cars = volt_like | { + CAR.CHEVROLET_BLAZER, + CAR.CHEVROLET_MALIBU_SDGM, + CAR.CHEVROLET_MALIBU_CC, + CAR.CHEVROLET_MALIBU_HYBRID_CC, + } + sdgm_non_volt = self.CP.carFingerprint in SDGM_CAR and \ + self.CP.carFingerprint not in kaofui_state_cars self.prev_cruise_buttons = self.cruise_buttons self.prev_distance_button = self.distance_button @@ -210,7 +217,14 @@ class CarState(CarStateBase): messages = [] if CP.networkLocation == NetworkLocation.fwdCamera and not CP.flags & GMFlags.NO_CAMERA.value: volt_like = {CAR.CHEVROLET_VOLT, CAR.CHEVROLET_VOLT_2019, CAR.CHEVROLET_VOLT_ASCM, CAR.CHEVROLET_VOLT_CAMERA, CAR.CHEVROLET_VOLT_CC} - sdgm_non_volt = CP.carFingerprint in SDGM_CAR and CP.carFingerprint not in volt_like + kaofui_state_cars = volt_like | { + CAR.CHEVROLET_BLAZER, + CAR.CHEVROLET_MALIBU_SDGM, + CAR.CHEVROLET_MALIBU_CC, + CAR.CHEVROLET_MALIBU_HYBRID_CC, + } + sdgm_non_volt = CP.carFingerprint in SDGM_CAR and \ + CP.carFingerprint not in kaofui_state_cars messages += [ ("ASCMLKASteeringCmd", 10), ] @@ -248,16 +262,24 @@ class CarState(CarStateBase): ] volt_like = {CAR.CHEVROLET_VOLT, CAR.CHEVROLET_VOLT_2019, CAR.CHEVROLET_VOLT_ASCM, CAR.CHEVROLET_VOLT_CAMERA, CAR.CHEVROLET_VOLT_CC} - sdgm_non_volt = CP.carFingerprint in SDGM_CAR and CP.carFingerprint not in volt_like + kaofui_state_cars = volt_like | { + CAR.CHEVROLET_BLAZER, + CAR.CHEVROLET_MALIBU_SDGM, + CAR.CHEVROLET_MALIBU_CC, + CAR.CHEVROLET_MALIBU_HYBRID_CC, + } + prndl2_rate = 10 if CP.carFingerprint in kaofui_state_cars else 40 + sdgm_non_volt = CP.carFingerprint in SDGM_CAR and \ + CP.carFingerprint not in kaofui_state_cars if sdgm_non_volt: messages += [ - ("ECMPRDNL2", 40), + ("ECMPRDNL2", prndl2_rate), ("AcceleratorPedal2", 40), ("ECMEngineStatus", 80), ] else: messages += [ - ("ECMPRDNL2", 40), + ("ECMPRDNL2", prndl2_rate), ("AcceleratorPedal2", 33), ("ECMEngineStatus", 100), ("BCMTurnSignals", 1), @@ -278,8 +300,9 @@ class CarState(CarStateBase): messages.append(("EBCMBrakePedalPosition", 100)) if CP.transmissionType == TransmissionType.direct: + regen_paddle_rate = 50 if CP.carFingerprint in kaofui_state_cars else 40 messages += [ - ("EBCMRegenPaddle", 40), + ("EBCMRegenPaddle", regen_paddle_rate), ("EVDriveMode", 0), ] diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 2b09b3fd9..b7ad3e7be 100644 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -179,9 +179,35 @@ class CarInterface(CarInterfaceBase): is_bolt_2022_2023_pedal = candidate == CAR.CHEVROLET_BOLT_CC_2022_2023 and ret.enableGasInterceptor - is_camera_acc = (candidate in CAMERA_ACC_CAR and candidate not in CC_ONLY_CAR and candidate not in kaofui_cars) or \ - (candidate == CAR.CHEVROLET_MALIBU_HYBRID_CC) - if is_camera_acc: + kaofui_camera_cars = { + CAR.CHEVROLET_VOLT_CAMERA, + CAR.CHEVROLET_VOLT_CC, + CAR.CHEVROLET_MALIBU_CC, + CAR.CHEVROLET_MALIBU_HYBRID_CC, + } + is_camera_acc = candidate in CAMERA_ACC_CAR and candidate not in CC_ONLY_CAR and candidate not in kaofui_cars + if candidate in kaofui_camera_cars: + # Keep Volt/Malibu camera path functionally aligned with kaofui. + 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.get(CanBus.OBSTACLE, {}) + ret.pcmCruise = True + ret.minEnableSpeed = 5 * CV.KPH_TO_MS + ret.minSteerSpeed = 10 * CV.KPH_TO_MS + gm_safety_cfg.safetyParam |= Panda.FLAG_GM_HW_CAM + + # Tuning for experimental long + ret.longitudinalTuning.kiV = [0.5, 0.5] + ret.stoppingDecelRate = 1.0 # reach brake quickly after enabling + ret.vEgoStopping = 0.25 + ret.vEgoStarting = 0.25 + ret.stopAccel = -0.25 + + if ret.experimentalLongitudinalAvailable and experimental_long: + ret.pcmCruise = False + ret.openpilotLongitudinalControl = True + gm_safety_cfg.safetyParam |= Panda.FLAG_GM_HW_CAM_LONG + elif is_camera_acc: # TorqueTune camera-ACC behavior ret.experimentalLongitudinalAvailable = (candidate not in CC_ONLY_CAR) and not ret.enableGasInterceptor ret.networkLocation = NetworkLocation.fwdCamera