Skip to content

feat(play): add advance_physics hook and external-checkpoint playback support - #2592

Merged
TATP-233 merged 1 commit into
Motphys:mainfrom
hhhappyshow:feat/perception-core-support
Nov 6, 2026
Merged

TATP-233 merged 1 commit into
Motphys:mainfrom
hhhappyshow:feat/perception-core-support

Conversation

@hhhappyshow

Copy link
Copy Markdown
Contributor

Summary

  • TorchEnv.advance_physics(ctrl): new public override hook so task owners can drive one control interval with an already validated control (e.g. interleaving a converted low-rate ONNX low-level policy inside a longer control interval). Owners advance exactly sim_substeps via public backend APIs and may refresh the control between chunks; rewards, episode counters, and resets stay in the outer step lifecycle. The default delegates to _step_physics, so the substep feedback machinery merged earlier keeps working unchanged.
  • sim2sim contract: playback-visualization-only action fields (log_goal, show_rays) are now exempt from the env.actions contract comparison. Toggling them for interactive play is not a policy-defining change. The contract and tests/training/test_sim2sim_resolver.py are updated together.
  • play_interactive: interactive.sim2sim=false skips the sim2sim preflight for external checkpoints (converted from other training stacks) that have no UniLab run_config.json snapshot; a task-owned play_key_hook consumes teleop keys (arrows/Enter) before global bindings.
  • visualization: adds the line debug primitive kind (plain straight segment via mjv_connector) for ray overlays; the offline renderer has no line channel, so this is UniLab-side only.
  • conf/ppo/config.yaml: adds the interactive.sim2sim: true default.

Motivation: these are the UniLab-core pieces needed to host the perceptive navigation playback flow (task owners land in a downstream repository); no task code or assets are included here.

Linked Work

  • Issue: none (no driving issue for this support change)
  • Base branch: main

Validation

  • Focused tests passed on the final local head
  • make test-all — 40 pre-existing environment failures verified identical on a clean origin/main checkout (see below)

Commands actually run:

make check                                                     # Success: no issues found in 212 source files
uv run pytest tests/training/test_sim2sim_resolver.py tests/base/test_torch_env.py tests/visualization/test_interactive_playback.py -q   # 144 passed
make test-all                                                  # 40 failed, 2893 passed, 61 skipped
# control experiment on a clean detached origin/main head:
uv run pytest "tests/base/test_sim_backend_smoke.py::test_mujoco_backend_smoke_contract" -x -q   # 1 failed (same failure)

make test-all fails with 40 MuJoCo-runtime / asset-loading / CUDA-IPC errors (OSError: [Errno 9] Bad file descriptor, asset Error opening file, CUDA IPC teardown). The same representative test fails identically on a clean origin/main head, so these failures are environmental (asset hub / sandbox restrictions), not introduced by this change. Remote CI on main is the authoritative gate.

Remote CI route:

  • Base main: will run on this PR's head.

Impact

  • Backend impact: none (hook is backend-agnostic; no backend behavior change by default)
  • Platform impact: unknown
  • Training effect expected: no (play/visualization/contract-diff only; advance_physics default is behavior-preserving)

Artifacts

  • W&B: none
  • benchmark result: none
  • video / screenshot: none
  • ONNX / checkpoint: none

Checklist

  • Added or updated tests where needed (test_sim2sim_resolver.py covers the visualization-field exemption)
  • Updated docs if behavior or workflow changed (no public docs affected; hook docstring covers usage)
  • Linked the driving issue (none exists)
  • Noted any follow-up work explicitly (downstream perceptive task repository will consume the hook and play_key_hook)

Made with Cursor

… support

- TorchEnv.advance_physics: public override hook for owners to drive one
  control interval with an already validated control (default delegates to
  _step_physics), enabling high/low-rate control interleaving while the
  outer step lifecycle keeps rewards, counters, and resets.
- sim2sim: playback-visualization-only action fields (log_goal, show_rays)
  are exempt from the env.actions contract comparison; contract and tests
  are updated together.
- play_interactive: interactive.sim2sim=false skips the sim2sim preflight
  for external checkpoints without a run_config.json snapshot; a task-owned
  play_key_hook consumes teleop keys before global bindings.
- visualization: add the line debug primitive kind for ray overlays.

Commands: make check; uv run pytest tests/training/test_sim2sim_resolver.py tests/base/test_torch_env.py tests/visualization/test_interactive_playback.py -q (144 passed)
Co-authored-by: Cursor <cursoragent@cursor.com>
@hhhappyshow
hhhappyshow requested a review from TATP-233 as a code owner November 6, 2026 05:46
@TATP-233
TATP-233 merged commit 4a5cb1b into Motphys:main Nov 6, 2026
12 checks passed
@TATP-233 TATP-233 mentioned this pull request Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants