mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-01 23:43:39 +08:00
Tolerate Model Y launch prediction noise at stops
This commit is contained in:
@@ -58,7 +58,11 @@ class StoppedLeadRelease:
|
||||
self.reset()
|
||||
return False
|
||||
velocities, times = tuple(model.velocity.x), tuple(ModelConstants.T_IDXS)
|
||||
if len(velocities) != 33 or len(times) != 33 or not all(math.isfinite(v) and -.05 <= v <= 100. for v in velocities):
|
||||
# A stationary Model Y can predict a few centimeters of reverse motion at launch.
|
||||
prefix_noise = cp.carFingerprint == 'TESLA_MODEL_Y' and min(model.position.x) >= -.03
|
||||
if (len(velocities) != 33 or len(times) != 33 or
|
||||
not all(math.isfinite(v) and (-.08 if prefix_noise and t < .2 else -.05) <= v <= 100.
|
||||
for v, t in zip(velocities, times, strict=True))):
|
||||
self.reset()
|
||||
return False
|
||||
tail = [v for v, t in zip(velocities, times, strict=True) if t >= 2.]
|
||||
|
||||
@@ -165,3 +165,29 @@ def test_niro_actual_cem_hold_releases_only_after_native_go(monkeypatch, vision)
|
||||
assert not case.owner.mode.projector.stop_detector.committed
|
||||
finally:
|
||||
case.doCleanups()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('fingerprint', 'slot', 'velocity', 'prefix_distance', 'clear'), [
|
||||
('TESLA_MODEL_Y', 4, -.075, -.025, True),
|
||||
('TESLA_MODEL_Y', 4, -.081, -.025, False),
|
||||
('TESLA_MODEL_Y', 6, -.075, -.025, False),
|
||||
('TESLA_MODEL_Y', 4, -.075, -.031, False),
|
||||
('KIA_NIRO_EV', 4, -.075, -.025, False),
|
||||
])
|
||||
def test_departure_tolerates_only_bounded_model_y_prefix_noise(fingerprint, slot, velocity, prefix_distance, clear):
|
||||
cp = CarParams(openpilotLongitudinalControl=True, carFingerprint=fingerprint)
|
||||
owner = StoppedLeadRelease()
|
||||
detector = SimpleNamespace(committed=True, standstill_committed=True, standstill_reason='light', commit_distance_m=3.)
|
||||
planner = SimpleNamespace(mpc=SimpleNamespace(solution_status=0), output_should_stop=False, output_a_target=.5,
|
||||
force_stop_plan=SimpleNamespace(forcing=False, should_stop=False))
|
||||
results = []
|
||||
for tick in range(13):
|
||||
now = green.MONO + 1_000_000_000 + tick * 50_000_000
|
||||
sm = scene(now, True)
|
||||
model = sm['modelV2']
|
||||
xs, velocities = list(model.position.x), list(model.velocity.x)
|
||||
xs[4], velocities[slot] = prefix_distance, velocity
|
||||
model.position.x, model.velocity.x = xs, velocities
|
||||
results.append(owner.sample(sm, cp, planner, detector, now_ns=now, drive_id=green.MONO-1_000_000_000))
|
||||
assert not any(results[:10])
|
||||
assert results[10:] == [clear] * 3
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "e84c5192138f8278786fa0d6ba68308a9f7b8c319c4a56a60ee7ced6adc60450", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "250492ad917d2aeee3e674edf0231149239dc5fb7be574b5139aba85aeecdc28", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user