Force Stop: Tweak3 Jerk Scale

This commit is contained in:
whoisdomi
2026-07-29 13:33:03 -05:00
parent 0ab17de780
commit c309cf177c
+6 -1
View File
@@ -30,6 +30,7 @@ from openpilot.starpilot.controls.lib.starpilot_vcruise import StarPilotVCruise
from openpilot.starpilot.controls.lib.weather_checker import WeatherChecker
RADARLESS_TRACK_HOLD_TIME = 0.45
FORCE_STOP_JERK_SCALE = 0.32 # accel-change cost multiplier while forcing_stop (125 -> ~40)
def _sanitize_json_value(value):
@@ -282,7 +283,11 @@ class StarPilotPlanner:
starpilot_plan_send.valid = sm.all_checks(service_list=["carState", "controlsState", "selfdriveState", "radarState"])
starpilotPlan = starpilot_plan_send.starpilotPlan
starpilotPlan.accelerationJerk = float(A_CHANGE_COST * self.starpilot_following.acceleration_jerk)
# While committed to a Force Stop, cut the MPC's accel-change penalty so terminal braking
# can ramp faster. At the default 125 it builds at only ~0.5 m/s^3, which leaves it short
# in the last ~10 m. 0.32 lands near 40 — the value long_mpc already uses in blended mode.
jerk_scale = FORCE_STOP_JERK_SCALE if self.starpilot_vcruise.forcing_stop else 1.0
starpilotPlan.accelerationJerk = float(A_CHANGE_COST * self.starpilot_following.acceleration_jerk * jerk_scale)
starpilotPlan.dangerFactor = float(self.starpilot_following.danger_factor)
starpilotPlan.dangerJerk = float(DANGER_ZONE_COST * self.starpilot_following.danger_jerk)
starpilotPlan.speedJerk = float(J_EGO_COST * self.starpilot_following.speed_jerk)