Add MuJoCo backend for racecar_core Drive/Lidar interface - #27
Conversation
Add MujocoController, MujocoDisplay, and MujocoRacecar to racecar_core_adapter.py, wiring the existing MujocoDrive/MujocoLidar into a start/update/update_slow/go event loop that mirrors racecar_core.Racecar's own contract. This lets an unmodified racecar_core controller script (e.g. neoracer-labs/ultimate-wall-follower/wall_follower.py) run against MuJoCo with only its `import racecar_core` needing to resolve to this class. Vendor a byte-for-byte copy of the canonical wall-following example under validation/testdata/ (see SOURCE.md for provenance) and add a pytest acceptance test proving it runs unmodified against MujocoRacecar via a sys.modules shim. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add examples/run_racecar_core.py, a process-level entry point that runs an unmodified racecar_core controller file against NeoRacer MuJoCo outside pytest: it composes and settles a walled-corridor scene, builds a MujocoRacecar, injects a fake racecar_core module into sys.modules whose create_racecar() returns it, puts the controller's own directory on sys.path for sibling imports, and executes the controller unchanged via runpy.run_path() so its own __main__ block drives the go() loop. Vendor the canonical wall-following example under examples/ultimate_wall_follower/ (byte-for-byte copy of validation/testdata/ultimate_wall_follower/, verified in test_run_racecar_core.py) as the runnable, drag-and-drop demo target for the new bootstrap. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Tier A racecar_core compatibility — completeTwo commits landed on this branch, on top of the original Drive/Lidar work:
What's newNeoRacer now provides Tier A compatibility for the RACECAR API through:
The canonical Production runtime bootstrapA real, non-pytest entry point now exists at: Run the canonical example with: python3 examples/run_racecar_core.py examples/ultimate_wall_follower/wall_follower.pyActual runtime validation of that exact command:
ValidationKnown scope boundaryTier A currently covers the RACECAR APIs this controller actually needs ( |
…ts tests Local checks had run against a stale 0.15.21 ruff in the dev conda env; CI (and requirements.txt's pinned ruff==0.16.0) caught RUF059 (unused unpacked variable), BLE001 (blind except, now justified with noqa at the CLI's top-level error handler), RUF100 (stale noqa), PLW1510 (subprocess.run without explicit check=), and formatting. No behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Follow-up: pushed |
- Trim the module docstring to what the adapter does and the two intentional sign/unit conventions it bridges (Thread 1). - Remove the unnecessary sensors-as-_sensors alias in racecar_core_adapter.py: it exists in sim.py because that module defines its own public sensors() function, but no such collision exists here (Thread 3). - Inline the _fresh(car) test helper -- all ~18 call sites now construct mujoco.MjData(car) directly (Thread 5). - Add a brief validation note to test_wall_follower_example.py documenting the additional steering-sign/LiDAR verification, and explicitly scoping the claim to compatibility, not autonomous wall-following success. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implements a thin MuJoCo adapter compatible with the racecar_core Drive and LiDAR interfaces.
This is intended to establish the shared controller interface between MuJoCo, Playground, and the physical car, and to unblock the Gymnasium environment work in #7.
Closes #8