unilab.visualization.playback_session.SnapshotPlaybackSession¶
- class unilab.visualization.playback_session.SnapshotPlaybackSession[source]¶
Bases:
objectCache physics snapshots during a trial; render them to video afterwards.
- Parameters:
Methods
__init__(env, *[, frame_state_getter, ...])clear()Drop all cached snapshots and overlays (call between trials).
render_snapshots(*, output_video[, ...])Render cached snapshots to
output_videoand return its path.snapshot()Cache one physics snapshot (and the current overlays, if configured).
Attributes
The cached physics states, in capture order.
- __init__(env, *, frame_state_getter=None, overlay_getter=None, render_spacing=None, width=1280, height=720, num_processes=8)[source]¶
- snapshot()[source]¶
Cache one physics snapshot (and the current overlays, if configured).
- Return type:
- render_snapshots(*, output_video, overlay_getter=None, camera=None, fps=None, on_frame=None)[source]¶
Render cached snapshots to
output_videoand return its path.overlay_getterhere is evaluated once per cached frame at render time and overrides the snapshot-time overlays captured through the constructor getter; prefer the constructoroverlay_getterfor state-coupled overlays.camerais normalized throughCameraCfg.from_kwargs()(unknown keys fail closed).on_framereceives(frame_index, frame)after rendering and may return a modified frame. ReturnsNonewhen the host cannot render off-screen (a warning is printed by the renderer).