Enable consensus tracker by default + round-world Strömbom fix

Two changes that together raise diff/round gym success ~52%→88% (BC)
and ~68%→88% (RL) without retraining; diff/field stays at 100%.

* TrackerConfig.consensus_k default 1 → 3 (radius 0.5 m, max_age 15
  frames). The same candidate-promotion mechanism that closed the
  Webots LiDAR gap also filters gym tracker phantoms — they show up
  on the round field where sheep run further between detection
  cycles than GATE_M, so each new position spawns a fresh track
  while the stale one persists in memory. SheepTracker() called with
  no tracker_cfg keeps the legacy pass-through behaviour for
  backwards compatibility.
* Strömbom + universal teachers now detect when the natural
  "behind the flock" drive target leaves the curved boundary and
  fall back to pushing the flock radially inward toward the centre.
  Breaks the wall-circling pattern that previously trapped both the
  analytical baselines and the trained policies.

A/B numbers (n_sheep ∈ {1,2,3,5,10}, 5 seeds each, max_steps=15000):

  diff/field  bc:  baseline 100%  consensus 100%
  diff/field  rl:  baseline 100%  consensus 100%
  diff/round  bc:  baseline  52%  consensus  88%
  diff/round  rl:  baseline  68%  consensus  88%

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Johnny Fernandes
2026-05-16 21:09:25 +00:00
parent 03b2df5656
commit 1c197e0ff7
4 changed files with 62 additions and 10 deletions
+8 -2
View File
@@ -68,9 +68,15 @@ class TestTrackerConfig:
assert cfg.max_new_tracks_per_step == 1
assert cfg.pen_latch_depth == 2.0
def test_default_consensus_disabled(self):
def test_default_consensus_enabled(self):
# Consensus is on by default — it filters tracker phantoms that
# confused the policy on the round field (52% → 88%) at no cost
# on the rectangular field (100% → 100%). Pass-through (k=1) is
# still available by explicitly constructing TrackerConfig(consensus_k=1).
cfg = TrackerConfig()
assert cfg.consensus_k == 1
assert cfg.consensus_k >= 2
assert cfg.consensus_radius_m > 0.0
assert cfg.consensus_max_age > cfg.consensus_k
def test_webots_preset_enables_consensus(self):
cfg = HERDING_WEBOTS.tracker