Truckothy

This commit is contained in:
firestar5683
2026-06-21 22:10:37 -05:00
parent e84c0e44ab
commit 32a6af9ac8
2 changed files with 72 additions and 1 deletions
@@ -427,3 +427,45 @@ def test_pedal_long_brake_bias_does_not_touch_non_pedal_or_mild_decel():
assert lc._apply_pedal_long_brake_bias(-1.0, -3.0, CS) == -1.0
assert lc._apply_pedal_long_brake_bias(-0.4, -0.6, CS) == -0.4
def test_gm_stock_truck_positive_i_bleeds_on_coast_request():
CP = car.CarParams.new_message()
CP.brand = "gm"
CP.carFingerprint = "CHEVROLET_SILVERADO"
CP.enableGasInterceptorDEPRECATED = False
CP.longitudinalTuning.kpBP = [0.0]
CP.longitudinalTuning.kpV = [0.02]
CP.longitudinalTuning.kiBP = [0.0]
CP.longitudinalTuning.kiV = [0.28]
lc = LongControl(CP)
lc.pid.i = 0.25
lc.last_output_accel = 0.20
CS = car.CarState.new_message(vEgo=20.0, aEgo=0.0, brakePressed=False)
CS.cruiseState.standstill = False
lc._trim_gm_truck_positive_hold_integrator(-0.02, -0.02, CS)
assert lc.pid.i < 0.25
def test_gm_stock_truck_positive_i_trim_skips_when_planner_still_requests_accel():
CP = car.CarParams.new_message()
CP.brand = "gm"
CP.carFingerprint = "CHEVROLET_SILVERADO"
CP.enableGasInterceptorDEPRECATED = False
CP.longitudinalTuning.kpBP = [0.0]
CP.longitudinalTuning.kpV = [0.02]
CP.longitudinalTuning.kiBP = [0.0]
CP.longitudinalTuning.kiV = [0.28]
lc = LongControl(CP)
lc.pid.i = 0.25
lc.last_output_accel = 0.20
CS = car.CarState.new_message(vEgo=20.0, aEgo=0.0, brakePressed=False)
CS.cruiseState.standstill = False
lc._trim_gm_truck_positive_hold_integrator(0.05, 0.05, CS)
assert lc.pid.i == pytest.approx(0.25, abs=1e-9)