From 07d1ece3d47d8dac86766e0dc29bf54e38bb2be0 Mon Sep 17 00:00:00 2001 From: Johnny Fernandes Date: Tue, 19 May 2026 15:57:27 +0000 Subject: [PATCH] Allow strafe_efficiency=1.0 in mec preset test; minor comment cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a deep investigation into the n=5 mecanum sim-to-real gap, all attempted fixes (consensus tightening, wall_reject tightening, static- phantom drop, deploy-time track merge, in-tracker track merge, fp_rate-augmented retrain, max_range cap, 140° mecanum retrain) failed to reliably pen n=5 in Webots without regressing n=10. The phantom problem at 360° + small flock is genuinely hard and out of scope for the deadline; documented in docs/status.md. Result preserved from the previous mecanum work: * 16/16 differential cells pen N/N. * 4/8 mecanum cells (all n=10) pen 10/10 via Supervisor kinematic injection (commit 27c0f65). * n=5 mecanum is the known gap. Small changes that survived the iteration: * tests/test_config.py — strafe_efficiency=1.0 is now valid (kinematic injection means the gym preset and Webots controller share the formula, so textbook values produce gym-identical body motion). * tools/run_webots.sh — refreshed the LiDAR-variant comment. * training/rl/train.py — comment polish. --- tests/test_config.py | 9 +++++++-- tools/run_webots.sh | 8 +++----- training/rl/train.py | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 59e717a..51c55f1 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -156,8 +156,13 @@ class TestRobotConfig: def test_mec_webots_preset(self): from herding.config import HERDING_MEC_WEBOTS - assert 0.0 < HERDING_MEC_WEBOTS.robot.strafe_efficiency < 1.0 - assert HERDING_MEC_WEBOTS.robot.strafe_to_forward_bleed < 0.0 + # Mecanum runs deploy via Supervisor kinematic injection + # (controllers/shepherd_dog/shepherd_dog.py:drive_mecanum), so + # whatever strafe_efficiency/strafe_to_forward_bleed the preset + # picks is what Webots will apply. The preset is allowed to be + # textbook (1.0, 0.0) or matched (<1.0, ≠0.0). + cfg = HERDING_MEC_WEBOTS.robot + assert 0.0 < cfg.strafe_efficiency <= 1.0 # --------------------------------------------------------------------------- diff --git a/tools/run_webots.sh b/tools/run_webots.sh index e1590ea..4d0c19b 100755 --- a/tools/run_webots.sh +++ b/tools/run_webots.sh @@ -90,11 +90,9 @@ fi cp "$SRC" "$DST" -# LiDAR FOV variant. For mecanum the default is 360° because the -# physical-roller proto's passive yaw drift makes the 140° front -# cone unreliable (heading errors push detections out of the -# tracker's world-frame matching gates). Diff defaults to 140° -# matching the canonical ShepherdDog.proto. +# LiDAR FOV variant. Mecanum defaults to 360° (the trained mecanum +# target); diff defaults to 140°. Override with HERDING_LIDAR=140 or +# HERDING_LIDAR=360 for ablations. if [[ -z "${HERDING_LIDAR:-}" ]]; then if [[ "$DRIVE" == "mecanum" ]]; then LIDAR_VARIANT="360" diff --git a/training/rl/train.py b/training/rl/train.py index b4e2aa7..6a466fa 100644 --- a/training/rl/train.py +++ b/training/rl/train.py @@ -279,7 +279,7 @@ def main() -> None: HerdingConfig, HERDING_MEC_WEBOTS_360, DomainRandomConfig, RobotConfig, ) herding_cfg = None - # Mecanum always trains under HERDING_MEC_WEBOTS_360 (360° LiDAR + + # Mecanum trains under HERDING_MEC_WEBOTS_360 (360° LiDAR + # kinematic-matched strafe scaling + small compass-noise DR). is_mecanum = (drive_mode == "mecanum") if is_mecanum or args.fp_rate > 0.0 or args.action_smooth > 0.0 or args.wheel_slip_std > 0.0: