From 69703fd2acade833e13f92d7585d7a24ab163db5 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sat, 13 Dec 2025 18:41:16 -0600 Subject: [PATCH] Torque Rest of Fleet --- frogpilot/common/frogpilot_variables.py | 1 + panda/board/obj/bootstub.panda.bin | Bin 14876 -> 14876 bytes panda/board/obj/bootstub.panda_h7.bin | Bin 16944 -> 16944 bytes panda/board/obj/panda.bin.signed | Bin 60680 -> 60680 bytes panda/board/obj/panda_h7.bin.signed | Bin 69512 -> 69512 bytes panda/board/safety/safety_gm.h | 4 +- selfdrive/car/gm/carcontroller.py | 60 +++++++++++++++++------- selfdrive/car/gm/interface.py | 4 +- selfdrive/car/gm/values.py | 18 +++++-- 9 files changed, 60 insertions(+), 27 deletions(-) diff --git a/frogpilot/common/frogpilot_variables.py b/frogpilot/common/frogpilot_variables.py index b91ca57de..63ae0040b 100644 --- a/frogpilot/common/frogpilot_variables.py +++ b/frogpilot/common/frogpilot_variables.py @@ -1002,6 +1002,7 @@ class FrogPilotVariables: volt_models = { "CHEVROLET_VOLT", + "CHEVROLET_VOLT_2019", "CHEVROLET_VOLT_ASCM", "CHEVROLET_VOLT_CAMERA", } diff --git a/panda/board/obj/bootstub.panda.bin b/panda/board/obj/bootstub.panda.bin index 8efaaee503d8c3f44441be575eeec3877567dc07..8ff046882865ac5b18c2f8ee2dbb3e5b02b38366 100755 GIT binary patch delta 21 ccmbPJGN)w2En^OgG)oghLo@TukBqI@0AQpC$N&HU delta 21 ccmbPJGN)w2En^PjBtr}HG(*$PkBqI@0AaER?*IS* diff --git a/panda/board/obj/bootstub.panda_h7.bin b/panda/board/obj/bootstub.panda_h7.bin index 2bc4c10dc7bb6d944e33bbd89466e4ce1ce96436..2ed656a52c9d4ee63ae661b731f49b117179a53b 100755 GIT binary patch delta 23 dcmdnc!ngs5X4!C9q*(mIMNjBD1cR8VLwEW;rx5 zF*Y}|(4V+Wf1~PaCa4hP6;>7E@D|E<+1wTb$7(6qfp{@t6XACuW|xS@CoEGYNW3i# z2BnlIVcwqzd=^DxXRLT5LO^^j-iY&DSzIoVV|?xmXPMPF$Uuh>Xt(B9U<08k(3p#1 l^g}ngjw!9kZ^M8VLw9Vlg;3 zW-&Fh(4V+Wf3AF;*t)1+D~Lh(P%K8ek#@m39;WC?+(N6&%F>Aqt>t9-SVPb8Q6JYW~X0@kFLn+g)yniF0YZh{SquOG diff --git a/panda/board/obj/panda_h7.bin.signed b/panda/board/obj/panda_h7.bin.signed index 9065a076fd7c0e6e3822405d96f1a08954e47447..99011df363c82780e21ca0b9b706ef6f4cdf6b2e 100644 GIT binary patch delta 180 zcmV;l089Ufp9F}X1h9mr0{J@gIA%FCF)=nb zvq-YQTz_qqS>WhW`86M`6>oU_V1L@RX0(B4FCqi0bJ=N;11xh1m% iKbr4-hGp8d?kK=1DcZkxV(TgHFvFhC0Ea9BVgZZm`&Xv` delta 180 zcmV;l089Ufp9F}X1h9mr0stJ7hNdbCNF4wG>J@gGh#6~H)b(4 zvq-YQTz^LwFkmg)l_|beg+LqzUU7?>vo{Dz?d?kbo~S&v!H<~nEyEBl*%sK}U3-Xz z?rII{Wy{Q!z*xogI^AfyW=KomZl4QWX$?0m*d6iJn 0: + # Volt should never present positive torque alongside friction braking + self.apply_gas = self.params.INACTIVE_REGEN else: - self.apply_gas = int(round(interp(accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) + 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_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.is_volt and self.apply_brake > 0: - # Volt should never present positive torque alongside friction braking - self.apply_gas = self.params.INACTIVE_REGEN + if self.apply_brake > 0 and self.apply_gas > self.params.INACTIVE_REGEN: + 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/interface.py b/selfdrive/car/gm/interface.py index ed505e270..e566946fd 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 = [1.0, 1.0] + 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.20 + ret.stopAccel = -0.25 if ret.experimentalLongitudinalAvailable and experimental_long: ret.pcmCruise = False diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index 2e78cb4da..a3a5e513e 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -38,12 +38,12 @@ class CarControllerParams: def __init__(self, CP): # Gas/brake lookups - self.ZERO_GAS = 6144 # Coasting + self.ZERO_GAS = 6150 # Coasting self.MAX_BRAKE = 400 # ~ -4.0 m/s^2 with regen self.BRAKE_SWITCH_MAX = self.ZERO_GAS - if CP.carFingerprint in (CAMERA_ACC_CAR | SDGM_CAR) and CP.carFingerprint not in CC_ONLY_CAR and CP.carFingerprint != CAR.CHEVROLET_BOLT_EUV: - self.MAX_GAS = 7496 + if CP.carFingerprint in CAMERA_ACC_CAR and CP.carFingerprint not in CC_ONLY_CAR and CP.carFingerprint != CAR.CHEVROLET_BOLT_EUV: + self.MAX_GAS = 8848 self.MAX_GAS_PLUS = 8848 self.MAX_ACC_REGEN = 5610 self.INACTIVE_REGEN = 5650 @@ -51,9 +51,17 @@ class CarControllerParams: # Camera transitions to MAX_ACC_REGEN from ZERO_GAS and uses friction brakes instantly self.max_regen_acceleration = 0. + elif CP.carFingerprint in SDGM_CAR and CP.carFingerprint not in CC_ONLY_CAR and CP.carFingerprint != CAR.CHEVROLET_BOLT_EUV: + self.MAX_GAS = 8191 + self.MAX_GAS_PLUS = 8191 + self.MAX_ACC_REGEN = 5500 + self.INACTIVE_REGEN = 5500 + # SDGM integrations match the ASCM longitudinal envelope + self.max_regen_acceleration = 0. + else: - self.MAX_GAS = 7168 # Safety limit, not ACC max. Stock ACC >8192 from standstill. - self.MAX_GAS_PLUS = 8191 # 8292 uses new bit, possible but not tested. Matches Twilsonco tw-main max + self.MAX_GAS = 8191 # Safety limit, not ACC max. Stock ACC >8192 from standstill. + self.MAX_GAS_PLUS = 8191 self.MAX_ACC_REGEN = 5500 # Max ACC regen is slightly less than max paddle regen self.INACTIVE_REGEN = 5500 # ICE has much less engine braking force compared to regen in EVs,