Qualify turn forecasts and producer clocks alongside highway wobble detection

This commit is contained in:
Codex
2026-11-18 12:21:26 -06:00
parent c1e83f616d
commit 6fa398fb4e
4 changed files with 39 additions and 2 deletions
@@ -18,7 +18,7 @@ PRODUCER_SOURCE_HASHES = (
('openpilot', 'system/camerad/cameras/spectra.cc', '4fa26c17f0fb792a4ab6815657beccddee1d641faa2fd02e5aa7393f717a2f3a'),
('openpilot', 'system/camerad/cameras/camera_qcom2.cc', 'b34c24c9984a0ac086f7b961cb7ff09d0501231da50aaad0e676bb3dc3f2edd9'),
('openpilot', 'system/camerad/cameras/camera_common.cc', 'bd9a416a6ee21047b4deec6df04276d8717cd92fe14de43f3e9daff86b62bb8f'),
('openpilot', 'selfdrive/modeld/modeld.py', '1b8d96ca9f7ac267d180732a6646b128bcbaec9ac79f80814030ec84197fd9d5'),
('openpilot', 'selfdrive/modeld/modeld.py', '58dc00dcfc6a497469ce71698f71650abcc5c995b299d560b576d291422eed3b'),
('openpilot', 'starpilot/car/volkswagen/model_smoothing.py', 'dd5d0ddaf77fe05960b673557b1b9f649d303ddfdad77a5185c7b3156fc6bbd2'),
('openpilot', 'starpilot/car/hyundai/model_smoothing.py', '28b1b8c64dd2d8e83f1bc71d39de7f797741d0911b39b7184a6e2d7d34d75243'),
('openpilot', 'selfdrive/modeld/fill_model_msg.py', 'b3916c34d1073d0c26a7a8adc51e7b148f63a1ac68b388226170fd0f8b8b56b4'),
File diff suppressed because one or more lines are too long
@@ -214,6 +214,42 @@ def test_recorded_highway_wobble_is_found_at_the_bookmark_without_new_applicatio
observation = recorded_observation('center_chatter', 'center', events[0]['peakScore'], 35.)
assert not coordinate_candidates([('same-source-window', observation)] * 20, values())
assert coordinate_candidates([(str(i), observation) for i in range(3)], values())
assert not oscillation_events([replace(s, actual_la=s.desired_la, error=0.) for s in samples])
def test_recorded_turn_forecasts_use_the_existing_turn_repair_with_fresh_sources():
import json
from pathlib import Path
from openpilot.cereal import log
from openpilot.starpilot.lateral.lane_change_smoothing import LaneChangeSmoother
from openpilot.starpilot.lateral.signal_turn import SignalTurnEvidence
from openpilot.starpilot.lateral.tests.test_signal_turn import BASE, OFFSET, frame
fixture = json.loads((Path(__file__).parent / 'fixtures/recorded_turn_forecasts.json').read_text())
assert fixture['source_sha256'] == '8a6d6067a6e0d4596fa8fcbbf4cf564d811d04b3844f6b5500f1ee0cacae2d1e'
owner, smoother = SignalTurnEvidence(), LaneChangeSmoother()
confirmed_before_lane_change = False
for row in fixture['rows']:
# Original numerical inputs; explicitly declared fresh receiver clocks, not a historical authority reconstruction.
sm, _, model = frame(0, 1)
now = BASE + row['dt_ns']
sm.logMonoTime, sm.recv_time = dict.fromkeys(sm, now), dict.fromkeys(sm, now / 1e9)
for name, value in row['car'].items():
setattr(sm['carState'], name, value)
sm['carControl'].latActive, sm['deviceState'].started = row['lat_active'], row['started']
sm['longitudinalPlan'].modelMonoTime, sm['longitudinalPlan'].shouldStop = now, row['plan_stop']
model.timestampEof, model.action.shouldStop = now + OFFSET, row['model_stop']
model.meta.desirePrediction, model.meta.laneChangeState = row['prediction'], row['lane_change_state']
ready = owner.observe(sm, model, model_ns=now, now_ns=now, now_boot_ns=now + OFFSET, valid=row['model_valid'], enabled=True)
state = model.meta.laneChangeState
if ready and state in (log.LaneChangeState.off, log.LaneChangeState.preLaneChange):
confirmed_before_lane_change = True
if state == log.LaneChangeState.laneChangeStarting:
assert confirmed_before_lane_change and ready
factor = smoother.factor(active=True, lane_change_state=state, speed=row['car']['vEgo'], minimum_speed=0., duration=5.777777777777778,
previous=.0015, desired=.015, turn_assist=True, intersection_turn=ready)
assert factor == 1., 'A confirmed intersection must not receive the extra lane-change slowing'
assert confirmed_before_lane_change
@pytest.mark.parametrize('kind', ['follows_request', 'small_error', 'one_lane_change', 'steady_curve', 'wheel_only',
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "0dadda27fa662944e40101a71e35722d4c979753729e39371ecd8055cdc2abf9", "schema_version": 1}
{"protected_inventory_sha256": "2f1f836e750dcc3d47ea609ac84c62ac32f72e50769a45c3efa079cde46c6df1", "schema_version": 1}