Drop versioning vocabulary, polish docstrings, fix world-aware policy resolution
User-facing pass after the project was decided to be a single
submission with no inner iterations.
* Remove every "v1"/"v2"/"versioning" reference from the docs:
- README mecanum section trims the "v1 predates the rewrite" prose
in favour of a self-contained retrain recipe.
- The 3.2 GB `training/runs/v1_clean/` backup directory is deleted.
* Refresh control-layer docstrings:
- `sheep_tracker.py` header now describes the three actual pipeline
stages (consensus, prediction, pen latching) instead of layering
the consensus stage on top of a stale "predictive mode" preamble.
- `controllers/shepherd_dog/shepherd_dog.py` mode list is
up-to-date — adds `universal`, removes outdated single-policy
default paths, mentions `HERDING_USE_GT=1` as the perception
ablation.
* Refresh training command examples:
- `training/bc/collect.py` and `training/bc/pretrain.py` usage
snippets show the world-suffixed paths the Makefile actually
uses; the `--out` arg is now required so old "demos.npz"
invocations error loudly instead of silently overwriting.
- `training/README.md` rewritten — drops the legacy `runs/bc`
diagram, documents the per-(drive, world) pipeline, and adds
the mecanum retraining caveat.
* Fix policy-directory resolution end-to-end:
- `tools/run_webots.sh` now tries
`training/runs/{bc,rl}_<drive>_<world>` first, then the drive-
only path, then the bare-mode legacy path — matching the actual
on-disk layout. Previously it looked for `bc_<drive>` (no
world) and silently fell back to `bc`, masking the world
selection.
- `controllers/shepherd_dog/shepherd_dog.py:_resolve_policy_dir`
has the same fix plus a latent NameError unmasked: it referenced
`DRIVE_MODE` before that variable was set at module load. The
block is restructured so MODE/DRIVE_MODE/WORLD are resolved
first, then the function uses them as explicit arguments.
126 pytest cases still pass.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,32 +1,26 @@
|
||||
"""Multi-target tracker for LiDAR-detected sheep.
|
||||
|
||||
Greedy nearest-neighbour data association across frames, with a wider
|
||||
re-acquisition gate for stale tracks (sheep flee during occlusion and
|
||||
reappear off-position), plus memory of last-seen positions for sheep
|
||||
out of FOV. Output is ``{name: (x, y)}`` — Strömbom / Sequential
|
||||
consume it directly.
|
||||
Three-stage greedy nearest-neighbour data association:
|
||||
|
||||
When **predictive mode** is enabled (the default), tracks carry a
|
||||
constant-velocity state ``(vx, vy)`` estimated from the last two
|
||||
observations. While a track is occluded its position is extrapolated
|
||||
using this velocity for up to ``PREDICT_STEPS`` frames, keeping the
|
||||
teacher's CoM estimate stable during brief losses. After prediction
|
||||
expires, the track falls back to its last-seen position (static memory)
|
||||
until ``FORGET_STEPS`` deletes it entirely.
|
||||
1. **Consensus promotion**. New detections start as *candidate* tracks
|
||||
invisible to ``get_positions``. They must accumulate ``consensus_k``
|
||||
matches within ``consensus_radius_m`` to promote; candidates that
|
||||
fail to re-confirm within ``consensus_max_age`` steps die. This
|
||||
filters one-shot LiDAR phantoms — wall returns, multi-cluster sheep
|
||||
splits, fast-moving sheep position jumps — at the cost of a small
|
||||
acquisition latency (~50 ms at the default ``consensus_k=3``).
|
||||
``consensus_k=1`` disables the stage.
|
||||
2. **Constant-velocity prediction**. Each track carries a smoothed
|
||||
``(vx, vy)``. While a track is occluded its position is
|
||||
extrapolated for up to ``PREDICT_STEPS`` frames, then falls back to
|
||||
last-seen static memory until ``FORGET_STEPS`` deletes it.
|
||||
3. **Pen latching**. A track whose estimated position crosses the gate
|
||||
plane south of ``is_penned_position`` is marked penned, excluded
|
||||
from ``get_positions``, and kept indefinitely.
|
||||
|
||||
A track is marked penned once its estimated position crosses the gate
|
||||
plane south (``is_penned_position``). Penned tracks are excluded from
|
||||
``get_positions`` and kept indefinitely.
|
||||
|
||||
**Consensus promotion** (``consensus_k > 1``): every new detection
|
||||
starts as a *candidate* track that is invisible to ``get_positions``.
|
||||
It must be matched ``consensus_k`` times within a tight radius
|
||||
(``consensus_radius_m``) before being promoted to a regular track.
|
||||
Candidates that fail to re-confirm within ``consensus_max_age`` steps
|
||||
are deleted. The cost is a small acquisition latency
|
||||
(``consensus_k * timestep`` ≈ 65 ms) in exchange for rejecting the
|
||||
one-shot LiDAR phantom returns Webots produces from real-world 3D
|
||||
geometry. ``consensus_k=1`` disables the stage entirely (default).
|
||||
Output of :meth:`SheepTracker.get_positions` is ``{name: (x, y)}`` —
|
||||
Strömbom, Sequential and the BC observation builder consume it
|
||||
directly.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
Reference in New Issue
Block a user