Bolt Pedal Friction Tune

This commit is contained in:
firestar5683
2026-06-24 22:51:14 -05:00
parent d08da1ff22
commit cec9f090c4
2 changed files with 24 additions and 10 deletions
+4 -6
View File
@@ -332,12 +332,10 @@ class LongControl:
if a_target >= pedal_regen_limit:
return feedforward
# Preserve the existing pedal/interceptor shaping up to the known regen
# envelope, then restore full-gain feedforward only for the extra decel
# that must be satisfied by friction blending.
pedal_component = pedal_regen_limit * self.feedforward_gain
friction_component = a_target - pedal_regen_limit
return pedal_component + friction_component
friction_gap = pedal_regen_limit - a_target
gain_restore = float(interp(friction_gap, [0.0, 0.25, 0.75], [0.0, 0.6, 1.0]))
effective_gain = self.feedforward_gain + ((1.0 - self.feedforward_gain) * gain_restore)
return a_target * effective_gain
def update(self, active, CS, a_target, should_stop, accel_limits, starpilot_toggles):
"""Update longitudinal control. This updates the state machine and runs a PID loop"""
+20 -4
View File
@@ -493,11 +493,27 @@ def test_bolt_acc_pedal_friction_feedforward_restores_full_gain_beyond_regen_env
CP.longitudinalTuning.kfDEPRECATED = 0.20
lc = LongControl(CP)
pedal_regen_limit = float(longcontrol.interp(4.73, longcontrol.BOLT_ACC_PEDAL_REGEN_LIMIT_BP,
longcontrol.BOLT_ACC_PEDAL_REGEN_LIMIT_V))
expected = pedal_regen_limit * 0.20 + (-3.22 - pedal_regen_limit)
assert lc._get_longitudinal_feedforward(-3.22, 4.73) == pytest.approx(expected)
assert lc._get_longitudinal_feedforward(-3.22, 4.73) == pytest.approx(-3.22)
def test_bolt_acc_pedal_friction_feedforward_blends_back_in_for_small_friction_request():
CP = make_longcontrol_cp(
brand="gm",
enableGasInterceptorDEPRECATED=True,
flags=GMFlags.PEDAL_LONG.value,
carFingerprint=CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL,
)
CP.longitudinalTuning.kfDEPRECATED = 0.20
lc = LongControl(CP)
pedal_regen_limit = float(longcontrol.interp(20.0, longcontrol.BOLT_ACC_PEDAL_REGEN_LIMIT_BP,
longcontrol.BOLT_ACC_PEDAL_REGEN_LIMIT_V))
a_target = pedal_regen_limit - 0.10
gain_restore = float(longcontrol.interp(0.10, [0.0, 0.25, 0.75], [0.0, 0.6, 1.0]))
expected = a_target * (0.20 + ((1.0 - 0.20) * gain_restore))
assert lc._get_longitudinal_feedforward(a_target, 20.0) == pytest.approx(expected)
def test_bolt_cc_pedal_friction_feedforward_remains_fully_scaled_by_kf():