From c309cf177ce92a91f69fde737c6ccd8c5fdb14ba Mon Sep 17 00:00:00 2001 From: whoisdomi Date: Wed, 29 Jul 2026 13:33:03 -0500 Subject: [PATCH] Force Stop: Tweak3 Jerk Scale --- starpilot/controls/starpilot_planner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/starpilot/controls/starpilot_planner.py b/starpilot/controls/starpilot_planner.py index 719a5e3dc..d92c2ac48 100644 --- a/starpilot/controls/starpilot_planner.py +++ b/starpilot/controls/starpilot_planner.py @@ -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)