From db3fbcb687e602218592be67609533c2d11101e9 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sat, 13 Dec 2025 23:50:15 -0600 Subject: [PATCH] Revert "Rest of Fleet V2" This reverts commit 22eb74e4c852a13061a1745f19042bc38b15c739. --- opendbc/gm_global_a_powertrain_generated.dbc | 1 + selfdrive/car/gm/carcontroller.py | 58 ++++++-------------- selfdrive/car/gm/gmcan.py | 1 + selfdrive/car/gm/interface.py | 4 +- 4 files changed, 21 insertions(+), 43 deletions(-) diff --git a/opendbc/gm_global_a_powertrain_generated.dbc b/opendbc/gm_global_a_powertrain_generated.dbc index 040e08fc6..aba27f0df 100644 --- a/opendbc/gm_global_a_powertrain_generated.dbc +++ b/opendbc/gm_global_a_powertrain_generated.dbc @@ -232,6 +232,7 @@ BO_ 715 ASCMGasRegenCmd: 8 K124_ASCM SG_ GasRegenFullStopActive : 13|1@0+ (1,0) [0|0] "" NEO SG_ GasRegenCmdActive : 0|1@0+ (1,0) [0|0] "" NEO SG_ RollingCounter : 7|2@0+ (1,0) [0|0] "" NEO + SG_ GasRegenAlwaysOne3 : 23|1@0+ (1,0) [0|1] "" NEO SG_ GasRegenCmd : 8|14@0+ (1,0) [0|0] "" NEO BO_ 717 ASCM_2CD: 5 K124_ASCM diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index e09fed884..cf1f68280 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -49,11 +49,12 @@ class CarController(CarControllerBase): self.params = CarControllerParams(self.CP) self.is_volt = self.CP.carFingerprint in (CAR.CHEVROLET_VOLT, CAR.CHEVROLET_VOLT_ASCM, CAR.CHEVROLET_VOLT_CAMERA, CAR.CHEVROLET_VOLT_CC) - self.mass = CP.mass - self.tireRadius = 0.075 * CP.wheelbase + 0.1453 - self.frontalArea = 1.05 * CP.wheelbase + 0.0679 - self.coeffDrag = 0.30 - self.airDensity = 1.225 + if self.is_volt: + self.mass = CP.mass + self.tireRadius = 0.075 * CP.wheelbase + 0.1453 + self.frontalArea = 1.05 * CP.wheelbase + 0.0679 + self.coeffDrag = 0.30 + self.airDensity = 1.225 self.params_ = Params() self.packer_pt = CANPacker(DBC[self.CP.carFingerprint]['pt']) @@ -165,46 +166,21 @@ class CarController(CarControllerBase): accel = clip(accel, self.params.ACCEL_MIN, self.params.ACCEL_MAX) brake_accel = clip(brake_accel, self.params.ACCEL_MIN, self.params.ACCEL_MAX) - if self.CP.carFingerprint in EV_CAR: - self.params.update_ev_gas_brake_threshold(CS.out.vEgo) - self.apply_gas = int(round(interp(accel, self.params.EV_GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) - self.apply_brake = int(round(interp(brake_accel, self.params.EV_BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) - else: - self.apply_gas = int(round(interp(accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) - self.apply_brake = int(round(interp(brake_accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) - - # Clamp within message-valid ranges to avoid ASCM faults from overshoot or rounding - self.apply_gas = int(round(clip(self.apply_gas, self.params.MAX_ACC_REGEN, self.params.MAX_GAS))) - self.apply_brake = int(round(clip(self.apply_brake, 0, self.params.MAX_BRAKE))) - - if self.apply_brake > 0: - # Volt should never present positive torque alongside friction braking - self.apply_gas = self.params.INACTIVE_REGEN + if self.CP.carFingerprint in EV_CAR: + self.params.update_ev_gas_brake_threshold(CS.out.vEgo) + self.apply_gas = int(round(interp(accel, self.params.EV_GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) + self.apply_brake = int(round(interp(brake_accel, self.params.EV_BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) else: - if len(CC.orientationNED) == 3 and CS.out.vEgo > self.CP.vEgoStopping: - accel_due_to_pitch = math.sin(CC.orientationNED[1]) * ACCELERATION_DUE_TO_GRAVITY - else: - accel_due_to_pitch = 0.0 - - gas_max = self.params.MAX_GAS - accel_max = self.params.ACCEL_MAX - - accel = clip(actuators.accel + accel_due_to_pitch, self.params.ACCEL_MIN, accel_max) - torque = self.tireRadius * ((self.mass * accel) + (0.5 * self.coeffDrag * self.frontalArea * self.airDensity * CS.out.vEgo ** 2)) - - scaled_torque = torque + self.params.ZERO_GAS - apply_gas_torque = clip(scaled_torque, self.params.MAX_ACC_REGEN, gas_max) - BRAKE_SWITCH = int(round(interp(CS.out.vEgo, self.params.BRAKE_SWITCH_LOOKUP_BP, self.params.BRAKE_SWITCH_LOOKUP_V))) - brake_accel = min((scaled_torque - BRAKE_SWITCH) / (self.tireRadius * self.mass), 0) - self.apply_gas = int(round(apply_gas_torque)) + self.apply_gas = int(round(interp(accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) self.apply_brake = int(round(interp(brake_accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) - # Clamp within message-valid ranges to avoid ASCM faults from overshoot or rounding - self.apply_gas = int(round(clip(self.apply_gas, self.params.MAX_ACC_REGEN, self.params.MAX_GAS))) - self.apply_brake = int(round(clip(self.apply_brake, 0, self.params.MAX_BRAKE))) + # Clamp within message-valid ranges to avoid ASCM faults from overshoot or rounding + self.apply_gas = int(round(clip(self.apply_gas, self.params.MAX_ACC_REGEN, self.params.MAX_GAS))) + self.apply_brake = int(round(clip(self.apply_brake, 0, self.params.MAX_BRAKE))) - if self.apply_brake > 0 and self.apply_gas > self.params.INACTIVE_REGEN: - self.apply_gas = self.params.INACTIVE_REGEN + if self.is_volt and self.apply_brake > 0: + # Volt should never present positive torque alongside friction braking + self.apply_gas = self.params.INACTIVE_REGEN # Don't allow any gas above inactive regen while stopping # FIXME: brakes aren't applied immediately when enabling at a stop if stopping: diff --git a/selfdrive/car/gm/gmcan.py b/selfdrive/car/gm/gmcan.py index 4594ed128..f2a87bae4 100644 --- a/selfdrive/car/gm/gmcan.py +++ b/selfdrive/car/gm/gmcan.py @@ -66,6 +66,7 @@ def create_gas_regen_command(packer, bus, throttle, idx, enabled, at_full_stop): "GasRegenFullStopActive": at_full_stop, "GasRegenAlwaysOne": 1, "GasRegenAlwaysOne2": 1, + "GasRegenAlwaysOne3": 1, } dat = packer.make_can_msg("ASCMGasRegenCmd", bus, values)[2] diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index e566946fd..ed505e270 100644 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -148,12 +148,12 @@ class CarInterface(CarInterfaceBase): ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM # Tuning for experimental long - ret.longitudinalTuning.kiV = [0.5, 0.5] + ret.longitudinalTuning.kiV = [1.0, 1.0] ret.stoppingDecelRate = 1.0 # reach brake quickly after enabling ret.vEgoStopping = 0.25 ret.vEgoStarting = 0.25 - ret.stopAccel = -0.25 + ret.stopAccel = -0.20 if ret.experimentalLongitudinalAvailable and experimental_long: ret.pcmCruise = False