This commit is contained in:
firestar5683
2026-07-13 10:07:16 -05:00
parent f81099af79
commit 361f692d53
2 changed files with 29 additions and 12 deletions
+15 -1
View File
@@ -1,6 +1,8 @@
import random
import numpy as np
import time
from types import SimpleNamespace
import numpy as np
import pytest
from cereal import messaging, log, car
@@ -44,6 +46,18 @@ def process_messages(estimator, lag_frames, n_frames, vego=20.0, rejection_thres
class TestLagd:
def test_manual_delay_uses_exact_configured_value(self):
mocked_CP = car.CarParams(steerActuatorDelay=0.11)
estimator = LateralLagEstimator(mocked_CP, DT)
estimator.starpilot_toggles = SimpleNamespace(
use_custom_steerActuatorDelay=True,
steerActuatorDelay=0.30,
)
msg = estimator.get_msg(True)
assert msg.liveDelay.lateralDelay == pytest.approx(0.30)
def test_read_saved_params(self):
params = Params()
@@ -1232,8 +1232,8 @@ function renderSettingRow(p) {
const isColor = p.ui_type === "color"
const isGroup = isGroupParam(p)
const isChild = p.parent_key ? "ds-child-modifier" : ""
const lockReason = getSettingLockReason(p)
const isLocked = lockReason !== ""
const lockReason = () => getSettingLockReason(p)
const isLocked = () => lockReason() !== ""
const ftmParamStatus = getFtmParamStatus(p.key)
const ftmTrialSummary = p.key === "AdvancedLateralTune" ? getFtmTrialSummary() : null
let rowControl = ""
@@ -1259,7 +1259,7 @@ function renderSettingRow(p) {
<div class="ds-stepper">
<button
class="ds-stepper-btn"
disabled="${() => isLocked || !canDecrease || false}"
disabled="${() => isLocked() || !canDecrease || false}"
@click="${() => stepNumericParam(p, -1)}">-</button>
<div class="ds-stepper-meta">
<span>${formatSliderValue(bounds.min, String(bounds.step), p.precision, p.key)} to ${formatSliderValue(bounds.max, String(bounds.step), p.precision, p.key)}</span>
@@ -1273,7 +1273,7 @@ function renderSettingRow(p) {
min="${bounds.min}"
max="${bounds.max}"
step="${bounds.step}"
disabled="${() => isLocked || updating}"
disabled="${() => isLocked() || updating}"
value="${() => formatNumericForInput(resolveCurrentNumericValue(p, numericBounds(p)), precision)}"
@keydown="${(e) => {
if (e.key !== "Enter") return
@@ -1282,17 +1282,17 @@ function renderSettingRow(p) {
}}" />
<button
class="ds-apply-btn"
disabled="${() => isLocked || updating}"
disabled="${() => isLocked() || updating}"
@click="${() => applyManualNumericParam(p)}">Apply</button>
</div>
<button
class="ds-reset-btn"
disabled="${() => isLocked || !canReset || false}"
disabled="${() => isLocked() || !canReset || false}"
@click="${() => resetNumericParam(p)}">Reset to Default</button>
</div>
<button
class="ds-stepper-btn"
disabled="${() => isLocked || !canIncrease || false}"
disabled="${() => isLocked() || !canIncrease || false}"
@click="${() => stepNumericParam(p, 1)}">+</button> </div>
`
})()}
@@ -1304,7 +1304,7 @@ function renderSettingRow(p) {
class="ds-select"
id="ds-${p.key}"
data-endpoint="${p.options_endpoint || ""}"
disabled="${() => isLocked}"
disabled="${() => isLocked()}"
@change="${() => updateParam(p.key, "dropdown")}">
<option value="">Loading...</option>
</select>
@@ -1316,12 +1316,12 @@ function renderSettingRow(p) {
type="color"
class="ds-color"
id="ds-${p.key}"
disabled="${() => isLocked}"
disabled="${() => isLocked()}"
value="${() => resolveColorInputValue(p)}"
@change="${() => updateParam(p.key, "color")}" />
<button
class="ds-reset-btn"
disabled="${() => isLocked || isStockColorValue(state.values[p.key])}"
disabled="${() => isLocked() || isStockColorValue(state.values[p.key])}"
@click="${() => resetColorParam(p)}">Stock</button>
</div>
`
@@ -1361,7 +1361,10 @@ function renderSettingRow(p) {
${ftmParamStatus ? html`<span class="ds-ftm-badge">Currently overridden by FTM</span>` : ""}
</div>
${p.description ? html`<div class="ds-row-desc">${p.description}</div>` : ""}
${lockReason ? html`<div class="ds-row-desc"><strong>Locked:</strong> ${lockReason}</div>` : ""}
${() => {
const reason = lockReason()
return reason ? html`<div class="ds-row-desc"><strong>Locked:</strong> ${reason}</div>` : ""
}}
${ftmParamStatus ? html`
<div class="ds-ftm-detail">
Effective now: <strong>${formatFtmValue(p, ftmParamStatus.effectiveValue)}</strong>.