From 82b669b4b3a98594206f46b8a0f260d728b4aa75 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Wed, 15 Apr 2026 07:53:12 -0500 Subject: [PATCH] volt --- opendbc_repo/opendbc/car/gm/interface.py | 9 ++++----- opendbc_repo/opendbc/car/gm/tests/test_gm.py | 9 +++++++-- selfdrive/controls/lib/longcontrol.py | 8 ++++---- selfdrive/controls/tests/test_longcontrol.py | 19 +++++++++++++++++++ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/opendbc_repo/opendbc/car/gm/interface.py b/opendbc_repo/opendbc/car/gm/interface.py index 673097ee3..e6e2fc2ea 100755 --- a/opendbc_repo/opendbc/car/gm/interface.py +++ b/opendbc_repo/opendbc/car/gm/interface.py @@ -568,15 +568,14 @@ class CarInterface(CarInterfaceBase): volt_test_tune_active = ( testing_ground.use_2 and - ret.enableGasInterceptorDEPRECATED and ret.openpilotLongitudinalControl and candidate in VOLT_LONG_TEST_TUNE_CARS ) if volt_test_tune_active: - # Volt interceptor-long currently falls back to an all-I tune on this path. - # The test-ground tune adds a modest P term, trims mid/high-speed I memory, - # and uses a dedicated starting state so stop-and-go launches do not wind - # up the PID. + # Volt long can still fall back to an all-I tune on both the interceptor and + # ASCM-int paths. The test-ground tune adds a modest P term, trims + # mid/high-speed I memory, and uses a dedicated starting state so + # stop-and-go launches do not wind up the PID. ret.longitudinalTuning.kpBP = [0.0, 4.0, 12.0, 35.0] ret.longitudinalTuning.kpV = [0.10, 0.072, 0.050, 0.040] ret.longitudinalTuning.kiBP = [0.0, 4.0, 12.0, 35.0] diff --git a/opendbc_repo/opendbc/car/gm/tests/test_gm.py b/opendbc_repo/opendbc/car/gm/tests/test_gm.py index 1e71a4b5e..9ad923a75 100644 --- a/opendbc_repo/opendbc/car/gm/tests/test_gm.py +++ b/opendbc_repo/opendbc/car/gm/tests/test_gm.py @@ -57,10 +57,15 @@ class TestGMInterface: assert car_params.minSteerSpeed == pytest.approx(7 * CV.MPH_TO_MS) - def test_volt_testing_ground_tune_sets_nonzero_p_and_starting_state(self, monkeypatch): + @parameterized.expand([ + ("interceptor", True), + ("ascm_int", False), + ]) + def test_volt_testing_ground_tune_sets_nonzero_p_and_starting_state(self, _name, pedal_present, monkeypatch): CarInterface = interfaces[CAR.CHEVROLET_VOLT_ASCM] fingerprint = _empty_fingerprint() - fingerprint[0][0x201] = 8 # pedal detected + if pedal_present: + fingerprint[0][0x201] = 8 # pedal detected fingerprint[0][0x2FF] = 8 # SASCM detected monkeypatch.setattr(gm_interface.testing_ground, "use_2", True, raising=False) diff --git a/selfdrive/controls/lib/longcontrol.py b/selfdrive/controls/lib/longcontrol.py index 8e9ad2072..454f6779d 100644 --- a/selfdrive/controls/lib/longcontrol.py +++ b/selfdrive/controls/lib/longcontrol.py @@ -118,8 +118,8 @@ class LongControl: self.is_gm_pedal_long = bool( CP.brand == "gm" and CP.enableGasInterceptorDEPRECATED and (CP.flags & GMFlags.PEDAL_LONG.value) ) - self.is_volt_interceptor = bool( - CP.brand == "gm" and CP.enableGasInterceptorDEPRECATED and str(CP.carFingerprint).startswith("CHEVROLET_VOLT") + self.is_volt = bool( + CP.brand == "gm" and str(CP.carFingerprint).startswith("CHEVROLET_VOLT") ) def update_mpc_mode(self, experimental_mode): @@ -155,7 +155,7 @@ class LongControl: self.integrator_hold_frames = 0 def _get_pedal_long_freeze(self, a_target, error, v_ego, accel_limits): - volt_test_tune_handoff = self.is_volt_interceptor and testing_ground.use_2 + volt_test_tune_handoff = self.is_volt and testing_ground.use_2 if not self.is_gm_pedal_long and not volt_test_tune_handoff: self.last_a_target = a_target @@ -185,7 +185,7 @@ class LongControl: return self.integrator_hold_frames > 0 or sat_pushing_lower or sat_pushing_upper def _shape_volt_test_tune_integrator(self, error, v_ego): - if not (self.is_volt_interceptor and testing_ground.use_2): + if not (self.is_volt and testing_ground.use_2): return # Bleed stale I quickly when the target reverses against stored integrator. diff --git a/selfdrive/controls/tests/test_longcontrol.py b/selfdrive/controls/tests/test_longcontrol.py index 19f525353..11633d7fb 100644 --- a/selfdrive/controls/tests/test_longcontrol.py +++ b/selfdrive/controls/tests/test_longcontrol.py @@ -142,3 +142,22 @@ def test_volt_testing_ground_handoff_freezes_integrator(monkeypatch): assert freeze assert lc.integrator_hold_frames > 0 + + +def test_non_interceptor_volt_testing_ground_handoff_freezes_integrator(monkeypatch): + CP = car.CarParams.new_message() + CP.brand = "gm" + CP.enableGasInterceptorDEPRECATED = False + CP.carFingerprint = "CHEVROLET_VOLT_ASCM" + CP.longitudinalTuning.kpBP = [0.0] + CP.longitudinalTuning.kpV = [0.1] + CP.longitudinalTuning.kiBP = [0.0] + CP.longitudinalTuning.kiV = [0.03] + + monkeypatch.setattr(longcontrol.testing_ground, "use_2", True, raising=False) + + lc = LongControl(CP) + freeze = lc._get_pedal_long_freeze(a_target=0.7, error=0.7, v_ego=8.0, accel_limits=(-3.0, 2.0)) + + assert freeze + assert lc.integrator_hold_frames > 0