This commit is contained in:
firestar5683
2026-07-15 20:43:45 -05:00
parent 8556708cd6
commit e943d2afd2
15 changed files with 9 additions and 66 deletions
-1
View File
@@ -599,7 +599,6 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> 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}},
@@ -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:
@@ -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]
@@ -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,
)
@@ -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,
)
@@ -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()
@@ -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,
)
@@ -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()]
-1
View File
@@ -76,7 +76,6 @@ SAFE_MODE_MANAGED_KEYS = (
"HumanLaneChanges",
"LeadDetectionThreshold",
"RecoveryPower",
"StopDistance",
"TacoTune",
"QOLLongitudinal",
"ForceStops",
-1
View File
@@ -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")
+4 -4
View File
@@ -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)),
@@ -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",
@@ -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",
-18
View File
@@ -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 <b>Model Randomizer</b>'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<QString> recoveryPowerButton{"Reset"};
modelToggle = new StarPilotParamValueButtonControl(param, title, desc, icon, 0.5, 2.0, QString(), std::map<float, QString>(), 0.1, false, {}, recoveryPowerButton, false, false);
recoveryPowerToggle = static_cast<StarPilotParamValueButtonControl*>(modelToggle);
} else if (param == "StopDistance") {
std::vector<QString> stopDistanceButton{"Reset"};
modelToggle = new StarPilotParamValueButtonControl(param, title, desc, icon, 4.0, 10.0, QString(), std::map<float, QString>(), 0.1, false, {}, stopDistanceButton, false, false);
stopDistanceToggle = static_cast<StarPilotParamValueButtonControl*>(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 <b>Stop Distance</b> 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
}
}
-1
View File
@@ -343,7 +343,6 @@ SteerRatioStock
StockConfidenceBallWidget
StopAccel
StopAccelStock
StopDistance
StoppedTimer
StoppingDecelRate
StoppingDecelRateStock