mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-28 00:53:45 +08:00
Resume Auto Learn discovery when the road regime changes
This commit is contained in:
@@ -738,9 +738,12 @@ class LiveTrackingOptimizer:
|
||||
# that maneuver ends. Three unmatched whole windows release it by
|
||||
# source time alone, without inspecting any tracking outcomes. No
|
||||
# incomplete comparison can confirm or persist a target.
|
||||
# Before launch, source-only discovery follows the current input regime.
|
||||
# Waiting three unmatched windows also suppresses native discovery
|
||||
# throughout a new short curve. No live trial or scored row is accepted.
|
||||
last_match = self.comparison[-1].end_ns if self.comparison else self.discovery['selected_end_ns']
|
||||
if (not _matches(self.discovery['anchor'], episode)
|
||||
and episode.end_ns - last_match >= 3 * (episode.end_ns - episode.start_ns)):
|
||||
and (self.rmse is None or episode.end_ns - last_match >= 3 * (episode.end_ns - episode.start_ns))):
|
||||
self._discard_selector()
|
||||
if self.discovery is not None:
|
||||
discovery = self.discovery
|
||||
|
||||
@@ -444,3 +444,33 @@ def test_fitted_plant_does_not_reverse_identified_direction_at_boundary():
|
||||
fitted_refresh(o, e.end_ns)
|
||||
o.observe_episode(e, now_ns=e.end_ns)
|
||||
assert o.discovery is None and o.offer_state is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('source_only', [False, True])
|
||||
def test_new_input_regime_retires_only_source_discovery_before_launch(source_only):
|
||||
from openpilot.starpilot.flm.tests.test_live_tracking import optimizer, refresh as fitted_refresh
|
||||
|
||||
o = owner() if source_only else optimizer()
|
||||
update = refresh if source_only else fitted_refresh
|
||||
for i in range(40):
|
||||
e = episode(o, i, 'center_taper_max', kind='subtle')
|
||||
if source_only:
|
||||
e = replace(e, normalization_accel=max(0.1, e.goal_rms))
|
||||
update(o, e.end_ns)
|
||||
o.observe_episode(e, now_ns=e.end_ns)
|
||||
if o.discovery is not None:
|
||||
break
|
||||
previous = o.discovery
|
||||
assert previous is not None and o.offer_state is None
|
||||
changed = episode(o, i + 1, 'center_taper_max', kind='large')
|
||||
if source_only:
|
||||
changed = replace(changed, normalization_accel=max(0.1, changed.goal_rms))
|
||||
update(o, changed.end_ns)
|
||||
o.observe_episode(changed, now_ns=changed.end_ns)
|
||||
assert (o.discovery is None) is source_only
|
||||
if source_only:
|
||||
assert o.selector_hint is None and not o.comparison
|
||||
assert o.baseline[-1].episode_id == changed.episode_id
|
||||
else:
|
||||
assert o.discovery == previous
|
||||
assert o.offer_state is None and not any(o.accepted.values())
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "da94b10aa940d202e229d8fb1e36321191a7aa2de68541fd8b2f19c6816bd876", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "65c1ade33b6f8f0712469790e4a2a6dc87f09c55a3253c1ee581bf9dba11d884", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user