Skip to content

Record viewport videos with Isaac Lab's video recorder - #1774

Draft
cvolkcvolk wants to merge 1 commit into
mainfrom
cvolk/fix/viewport-video-recording
Draft

cvolkcvolk wants to merge 1 commit into
mainfrom
cvolk/fix/viewport-video-recording

Conversation

@cvolkcvolk

Copy link
Copy Markdown
Collaborator

Fix --record_viewport_video, which has written no video since Arena moved to Isaac Lab 3.0. The Kit viewer is now recorded by Isaac Lab's VideoRecorder, configured on the env config.

Why this change?

wrap_env_for_video wrapped the env in gymnasium's RecordVideo, which reads frames from env.render(). In Isaac Lab 3.0, ManagerBasedRLEnv.render() returns None for render_mode="rgb_array" and points to VideoRecorderCfg on env_cfg.video_recorders instead. RecordVideo stops with a warning, and the Run still reports completed.

This affects experiment_runner.py, policy_runner.py, the OSMO record_viewport_video option, and the review GUI's sim preview, which raises expected one viewport video, found 0.

What changes?

  • add_viewport_video_recorder adds a VideoRecorderCfg(source="visualizer:kit") to the env config before the env is made. The env records every step, and env.close() writes the clip. wrap_env_for_video keeps only the step timer and the camera recorder.
  • --record_viewport_video requires --viz kit and asserts it. Kit opens no window when DISPLAY is unset. The flag also enables camera support, because the Kit visualizer captures frames through Replicator. It does not add the environment's cameras. The OSMO task passes --viz kit when it records the viewport.
  • Each rebuild writes viewport-rebuild<i>_0000.mp4 to the Run directory, and policy_runner.py writes viewport_0000.mp4.
  • The v0.4 migration guide described a rl-video-step-0.mp4 file that v0.4 never wrote. It now says v0.4 writes no viewport video, and the v0.5 guide lists the fix.

Limitations:

  • The first frame of each clip is black. KitVisualizer.render_rgb_array returns a blank frame while RTX warms up.
  • With viewport recording on, the sim_step timer includes the frame captures, because they now run inside env.step.

Validation

  • Recorded pick_and_place_maple_table with experiment_runner.py (45 steps, 45 frames) and policy_runner.py (20 steps, 20 frames) in Docker with DISPLAY unset, and checked the frames.
  • Not checked: the OSMO image, the review GUI's sim preview, and Newton.

--record_viewport_video has written no video since Arena moved to
Isaac Lab 3.0. wrap_env_for_video wrapped the env in gymnasium's
RecordVideo, which reads frames from env.render(), and Isaac Lab now
returns None there for render_mode="rgb_array". The Run still reported
completed.

add_viewport_video_recorder adds a VideoRecorderCfg that records the
Kit viewer to the env config before the env is made. The env records
every step, and env.close() writes the clip. wrap_env_for_video keeps
the step timer and the camera recorder.

The Kit capture runs through Replicator, so --record_viewport_video now
enables camera support and requires --viz kit, which opens no window
when DISPLAY is unset. The OSMO task passes --viz kit when it records
the viewport. Each rebuild writes viewport-rebuild<i>_0000.mp4.

Signed-off-by: Clemens Volk <[email protected]>

This branch has not been deployed

No deployments
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