diff --git a/common/params_keys.h b/common/params_keys.h index 2a4a36c587..7d2bd8819b 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -599,7 +599,6 @@ inline static std::unordered_map keys = { {"StopAccel", {PERSISTENT, FLOAT, "0.0", "0.0", 3}}, {"StopAccelStock", {PERSISTENT, FLOAT, "0.0", "0.0", 3}}, {"StoppedTimer", {PERSISTENT, BOOL, "0", "0", 1}}, - {"StopDistance", {PERSISTENT, FLOAT, "6.0", "6.0", 2}}, {"StoppingDecelRate", {PERSISTENT, FLOAT, "0.0", "0.0", 3}}, {"StoppingDecelRateStock", {PERSISTENT, FLOAT, "0.0", "0.0", 3}}, {"StarButtonControl", {PERSISTENT, INT, "0", "0", 2}}, diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py b/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py index 12fa3a8e0b..001e85ccda 100755 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py +++ b/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py @@ -211,11 +211,7 @@ def get_stopped_equivalence_factor(v_lead): return (v_lead**2) / (2 * COMFORT_BRAKE) def get_safe_obstacle_distance(v_ego, t_follow): - from openpilot.common.params import Params - params = Params() - stop_str = params.get("StopDistance", encoding="utf8") - stop_distance = float(stop_str) if stop_str else STOP_DISTANCE - return (v_ego**2) / (2 * COMFORT_BRAKE) + t_follow * v_ego + stop_distance + return (v_ego**2) / (2 * COMFORT_BRAKE) + t_follow * v_ego + STOP_DISTANCE def desired_follow_distance(v_ego, v_lead, t_follow=None): if t_follow is None: diff --git a/selfdrive/controls/lib/longitudinal_planner.py b/selfdrive/controls/lib/longitudinal_planner.py index 744c69b2a3..da174189a3 100755 --- a/selfdrive/controls/lib/longitudinal_planner.py +++ b/selfdrive/controls/lib/longitudinal_planner.py @@ -2901,7 +2901,7 @@ class LongitudinalPlanner: self.a_desired = min(self.a_desired, close_lead_brake_cap) output_a_target = min(output_a_target, close_lead_brake_cap) - standstill_nudge_gap = max(float(getattr(starpilot_toggles, "stop_distance", STOP_DISTANCE)), STOP_DISTANCE) - 0.5 + standstill_nudge_gap = STOP_DISTANCE - 0.5 moving_leads = [lead for lead in (self.lead_one, self.lead_two) if lead.status and lead.vLead > STANDSTILL_LEAD_NUDGE_MIN_SPEED and lead.dRel >= standstill_nudge_gap] diff --git a/selfdrive/controls/tests/test_conditional_experimental_mode.py b/selfdrive/controls/tests/test_conditional_experimental_mode.py index 7df4826e89..2b0d20d9d2 100644 --- a/selfdrive/controls/tests/test_conditional_experimental_mode.py +++ b/selfdrive/controls/tests/test_conditional_experimental_mode.py @@ -963,7 +963,6 @@ def test_starpilot_planner_updates_cem_with_current_frame_state(monkeypatch): minimum_lane_change_speed=100.0, pause_lateral_below_speed=0.0, pause_lateral_below_signal=False, - stop_distance=6.0, weather_presets=False, ) diff --git a/selfdrive/controls/tests/test_longitudinal_planner.py b/selfdrive/controls/tests/test_longitudinal_planner.py index b672b68c81..2f3c1dca76 100644 --- a/selfdrive/controls/tests/test_longitudinal_planner.py +++ b/selfdrive/controls/tests/test_longitudinal_planner.py @@ -128,7 +128,6 @@ def make_toggles(model_version: str = "v11", radar_takeoffs: bool = False): classic_model=False, tinygrad_model=True, model_version=model_version, - stop_distance=6.0, vEgoStopping=0.5, radar_takeoffs=radar_takeoffs, ) diff --git a/selfdrive/controls/tests/test_starpilot_planner.py b/selfdrive/controls/tests/test_starpilot_planner.py index bd3ea806cb..5e3243aaae 100644 --- a/selfdrive/controls/tests/test_starpilot_planner.py +++ b/selfdrive/controls/tests/test_starpilot_planner.py @@ -27,7 +27,6 @@ def make_toggles(**overrides): "pause_lateral_below_signal": True, "pause_lateral_signal_delay": 0.0, "set_speed_offset": 0, - "stop_distance": 6.0, "weather_presets": False, } defaults.update(overrides) @@ -136,7 +135,7 @@ def test_radarless_follow_hold_applies_to_tracked_vision_lead(monkeypatch): radar=False, ) - planner.update_lead_status(27.5, stop_distance=6.0) + planner.update_lead_status(27.5) assert planner.radarless_follow_hold_until > 100.0 finally: planner.shutdown() @@ -159,7 +158,7 @@ def test_tracked_vision_lead_uses_exit_hysteresis_at_mid_speed(): radar=False, ) - assert planner.update_lead_status(16.8, stop_distance=6.0) + assert planner.update_lead_status(16.8) finally: planner.shutdown() @@ -179,6 +178,6 @@ def test_untracked_vision_lead_still_uses_strict_entry_gate(): radar=False, ) - assert not planner.update_lead_status(16.8, stop_distance=6.0) + assert not planner.update_lead_status(16.8) finally: planner.shutdown() diff --git a/selfdrive/test/longitudinal_maneuvers/plant.py b/selfdrive/test/longitudinal_maneuvers/plant.py index 8f1bcebe12..222df45ffd 100755 --- a/selfdrive/test/longitudinal_maneuvers/plant.py +++ b/selfdrive/test/longitudinal_maneuvers/plant.py @@ -108,7 +108,6 @@ class Plant: classic_model=False, tinygrad_model=True, model_version="v11", - stop_distance=6.0, longitudinalActuatorDelay=0.2, vEgoStopping=0.5, ) diff --git a/selfdrive/ui/layouts/settings/starpilot/driving_model.py b/selfdrive/ui/layouts/settings/starpilot/driving_model.py index f78a9dce65..3ced39068a 100644 --- a/selfdrive/ui/layouts/settings/starpilot/driving_model.py +++ b/selfdrive/ui/layouts/settings/starpilot/driving_model.py @@ -252,8 +252,6 @@ class DrivingModelManagerView(AetherInteractiveMixin, Widget): self._controller._on_scores_clicked() elif action == "recovery_power": self._controller._on_recovery_power_clicked() - elif action == "stop_distance": - self._controller._on_stop_distance_clicked() return def _render(self, rect: rl.Rectangle): @@ -963,13 +961,6 @@ class StarPilotDrivingModelLayout(_SettingsPage): "type": "value", "value": f"{self._params.get_float('RecoveryPower'):.1f}x", }, - { - "id": "stop_distance", - "title": tr("Stop Distance"), - "subtitle": tr("Preferred gap held at a complete stop."), - "type": "value", - "value": f"{self._params.get_float('StopDistance'):.1f}m", - }, ] ) @@ -1100,9 +1091,6 @@ class StarPilotDrivingModelLayout(_SettingsPage): def _on_recovery_power_clicked(self): self._show_slider("RecoveryPower", 0.5, 2.0, step=0.1, unit="x", value_type="float", title="Recovery Power", color=PANEL_STYLE.accent) - def _on_stop_distance_clicked(self): - self._show_slider("StopDistance", 4.0, 10.0, step=0.1, unit="m", value_type="float", title="Stop Distance", color=PANEL_STYLE.accent) - def _on_blacklist_clicked(self): blacklisted = [m.strip() for m in (self._params.get("BlacklistedModels", encoding="utf-8") or "").split(",") if m.strip()] diff --git a/starpilot/common/safe_mode.py b/starpilot/common/safe_mode.py index 20e00397be..442fb30a52 100644 --- a/starpilot/common/safe_mode.py +++ b/starpilot/common/safe_mode.py @@ -76,7 +76,6 @@ SAFE_MODE_MANAGED_KEYS = ( "HumanLaneChanges", "LeadDetectionThreshold", "RecoveryPower", - "StopDistance", "TacoTune", "QOLLongitudinal", "ForceStops", diff --git a/starpilot/common/starpilot_variables.py b/starpilot/common/starpilot_variables.py index bbbb35ecfa..21d98d92fa 100644 --- a/starpilot/common/starpilot_variables.py +++ b/starpilot/common/starpilot_variables.py @@ -1183,7 +1183,6 @@ class StarPilotVariables: lead_detection_probability = float(np.clip(lead_detection_probability * 0.01, 0.25, 0.5)) toggle.lead_detection_probability = lead_detection_probability toggle.recovery_power = self.get_value("RecoveryPower", cast=float, condition=longitudinal_tuning, default=1.0, min=0.5, max=2.0) - toggle.stop_distance = self.get_value("StopDistance", cast=float, condition=longitudinal_tuning, default=6.0) toggle.taco_tune = self.get_value("TacoTune", condition=longitudinal_tuning) toggle.model = self.get_value("Model", cast=None, default="sc2") diff --git a/starpilot/controls/starpilot_planner.py b/starpilot/controls/starpilot_planner.py index db48cfa300..719a5e3dcd 100644 --- a/starpilot/controls/starpilot_planner.py +++ b/starpilot/controls/starpilot_planner.py @@ -204,7 +204,7 @@ class StarPilotPlanner: self.road_curvature_detected = (1 / abs(self.road_curvature))**0.5 < v_ego > CRUISING_SPEED and not (sm["carState"].leftBlinker or sm["carState"].rightBlinker) if not sm["carState"].standstill: - self.tracking_lead = self.update_lead_status(v_ego, starpilot_toggles.stop_distance) + self.tracking_lead = self.update_lead_status(v_ego) self.starpilot_following.update(controls_enabled, v_ego, sm, starpilot_toggles) @@ -231,12 +231,12 @@ class StarPilotPlanner: else: self.starpilot_weather.weather_id = 0 - def update_lead_status(self, v_ego, stop_distance=STOP_DISTANCE): + def update_lead_status(self, v_ego): following_lead = should_track_lead( self.lead_one.status, self.lead_one.dRel, self.model_length, - stop_distance, + STOP_DISTANCE, v_ego, v_lead=self.lead_one.vLead, radar=bool(getattr(self.lead_one, "radar", False)), @@ -247,7 +247,7 @@ class StarPilotPlanner: self.lead_one.status, self.lead_one.dRel, self.model_length, - stop_distance, + STOP_DISTANCE, v_ego, model_prob=float(getattr(self.lead_one, "modelProb", 0.0)), y_rel=float(getattr(self.lead_one, "yRel", 0.0)), diff --git a/starpilot/system/the_galaxy/assets/components/tools/device_settings_layout.json b/starpilot/system/the_galaxy/assets/components/tools/device_settings_layout.json index a37203559e..97ecf7d0c9 100644 --- a/starpilot/system/the_galaxy/assets/components/tools/device_settings_layout.json +++ b/starpilot/system/the_galaxy/assets/components/tools/device_settings_layout.json @@ -3617,16 +3617,6 @@ "max": 2.0, "step": 0.1 }, - { - "key": "StopDistance", - "label": "Stop Distance", - "description": "Adjust the model's stopping distance in meters (minimum 4 for safety). Most users prefer 6.", - "data_type": "float", - "ui_type": "numeric", - "min": 4.0, - "max": 10.0, - "step": 0.1 - }, { "key": "DrivingModel", "label": "Select Driving Model", diff --git a/starpilot/system/the_galaxy/the_galaxy.py b/starpilot/system/the_galaxy/the_galaxy.py index 6f4f62bbba..02b76d2fb0 100644 --- a/starpilot/system/the_galaxy/the_galaxy.py +++ b/starpilot/system/the_galaxy/the_galaxy.py @@ -901,11 +901,6 @@ _TROUBLESHOOT_SECTION_DEFINITIONS = [ "title": "Personality Profile Settings", "keys": _TROUBLESHOOT_PERSONALITY_KEYS, }, - { - "id": "model_stop_distance", - "title": "Model Stop Distance", - "keys": ["StopDistance"], - }, { "id": "cem_settings", "title": "CEM Settings", diff --git a/starpilot/ui/qt/offroad/model_settings.cc b/starpilot/ui/qt/offroad/model_settings.cc index 00b25878d2..382869b7ad 100644 --- a/starpilot/ui/qt/offroad/model_settings.cc +++ b/starpilot/ui/qt/offroad/model_settings.cc @@ -142,14 +142,12 @@ StarPilotModelPanel::StarPilotModelPanel(StarPilotSettingsWindow *parent) : Star {"DownloadModel", tr("Download Driving Models"), tr("Download driving models to the device."), ""}, {"ModelRandomizer", tr("Model Randomizer"), tr("Driving models are chosen at random each drive and feedback prompts are used to find the model that best suits your needs."), ""}, {"RecoveryPower", tr("Recovery Power"), tr("Adjust the strength of planplus lane recovery corrections (0.5 to 2.0)."), ""}, - {"StopDistance", tr("Stop Distance"), tr("Adjust the model's stopping distance in meters (minimum 4 for safety). Most users prefer 6."), ""}, {"ManageBlacklistedModels", tr("Manage Model Blacklist"), tr("Add or remove models from the Model Randomizer's blacklist list."), ""}, {"ManageScores", tr("Manage Model Ratings"), tr("Reset or view the saved ratings for the driving models."), ""}, {"SelectModel", tr("Select Driving Model"), tr("Select the active driving model."), ""}, }; StarPilotParamValueButtonControl *recoveryPowerToggle = nullptr; - StarPilotParamValueButtonControl *stopDistanceToggle = nullptr; for (const auto &[param, title, desc, icon] : modelToggles) { AbstractControl *modelToggle; @@ -549,10 +547,6 @@ StarPilotModelPanel::StarPilotModelPanel(StarPilotSettingsWindow *parent) : Star std::vector recoveryPowerButton{"Reset"}; modelToggle = new StarPilotParamValueButtonControl(param, title, desc, icon, 0.5, 2.0, QString(), std::map(), 0.1, false, {}, recoveryPowerButton, false, false); recoveryPowerToggle = static_cast(modelToggle); - } else if (param == "StopDistance") { - std::vector stopDistanceButton{"Reset"}; - modelToggle = new StarPilotParamValueButtonControl(param, title, desc, icon, 4.0, 10.0, QString(), std::map(), 0.1, false, {}, stopDistanceButton, false, false); - stopDistanceToggle = static_cast(modelToggle); } else { modelToggle = new ParamControl(param, title, desc, icon); } @@ -591,16 +585,6 @@ StarPilotModelPanel::StarPilotModelPanel(StarPilotSettingsWindow *parent) : Star }); } - if (stopDistanceToggle) { - QObject::connect(stopDistanceToggle, &StarPilotParamValueButtonControl::buttonClicked, [this, stopDistanceToggle]() { - if (ConfirmationDialog::confirm(tr("Are you sure you want to reset your Stop Distance to the default of 6 meters?"), tr("Reset"), this)) { - params.putFloat("StopDistance", 6.0); - stopDistanceToggle->refresh(); - updateStarPilotToggles(); - } - }); - } - QObject::connect(parent, &StarPilotSettingsWindow::closeSubPanel, [modelLayout, modelPanel] {modelLayout->setCurrentWidget(modelPanel);}); QObject::connect(uiState(), &UIState::uiUpdate, this, &StarPilotModelPanel::updateState); } @@ -860,8 +844,6 @@ void StarPilotModelPanel::updateToggles() { setVisible &= !params.getBool("ModelRandomizer"); } else if (key == "RecoveryPower") { setVisible &= (tuningLevel == 3); // Only visible in developer tuning level - } else if (key == "StopDistance") { - setVisible &= (tuningLevel == 3); // Only visible in developer tuning level } } diff --git a/tools/StarPilot/feasibleparams.txt b/tools/StarPilot/feasibleparams.txt index 51b6308f51..004cb4f4ee 100644 --- a/tools/StarPilot/feasibleparams.txt +++ b/tools/StarPilot/feasibleparams.txt @@ -343,7 +343,6 @@ SteerRatioStock StockConfidenceBallWidget StopAccel StopAccelStock -StopDistance StoppedTimer StoppingDecelRate StoppingDecelRateStock