This commit is contained in:
firestar5683
2026-04-15 07:53:12 -05:00
parent a047547f44
commit 82b669b4b3
4 changed files with 34 additions and 11 deletions
+4 -5
View File
@@ -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]
+7 -2
View File
@@ -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)
+4 -4
View File
@@ -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.
@@ -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