Skip to content

Add reset-aware camera render intervals#1025

Open
zchJo wants to merge 1 commit into
mujocolab:mainfrom
zchJo:camera-render-interval
Open

Add reset-aware camera render intervals#1025
zchJo wants to merge 1 commit into
mujocolab:mainfrom
zchJo:camera-render-interval

Conversation

@zchJo

@zchJo zchJo commented May 28, 2026

Copy link
Copy Markdown

Add the feature mentioned in [Reset-aware camera render intervals for batched visual RL · Issue #1024 · mujocolab/mjlab](#1024).

This adds CameraSensorCfg.render_update_period, defaulting to 1 so existing camera behavior is unchanged. When users set a larger period, mjlab skips camera rendering on intermediate sim.sense() calls and leaves the previous RGB/depth/segmentation buffers in place. Environment resets and GUI-driven reset updates force a fresh full-batch camera render, which keeps post-reset visual observations current without requiring users to render cameras every control step.

The implementation keeps using MuJoCo Warp's public refit_bvh and render APIs. It does not implement selected-world rendering yet; that remains a possible follow-up after discussion in the linked issue and in google-deepmind/mujoco_warp#1373.

Tests cover skipped camera updates, forced refresh after a skipped update, rejection of mismatched render periods across cameras that share one render context, and the existing camera and auto-reset paths. Documentation and the changelog were updated for the new configuration option.

Check results:

  • UV_NO_SYNC=1 make check: passed.
  • UV_NO_SYNC=1 make test: passed, 903 passed.
  • UV_NO_SYNC=1 make test-all: passed, 903 passed.
  • UV_NO_SYNC=1 uv run pytest tests/test_camera_sensor.py: passed, 17 passed.
  • UV_NO_SYNC=1 uv run pytest tests/test_auto_reset.py: passed, 6 passed.
  • git diff --check: passed.

Camera sensors can now set `render_update_period` to render images every N `sim.sense()` calls while reusing the previous camera buffers on skipped calls. Reset paths force a fresh camera render so post-reset visual observations remain current.
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.

1 participant