unilab.base.base.ABEnv¶
- class unilab.base.base.ABEnv[source]¶
Bases:
ABCMethods
__init__()Capture one RGB frame through the env-facing video contract.
close()Clean up environment resources
Return a physics snapshot for offline playback/video export.
get_playback_model([env_index])Return a model object suitable for backend-specific playback tooling.
init_play_renderer([render_spacing, ...])Initialize env-facing playback rendering when supported.
Initialize environment and return initial state
render([mode])Render the current state;
mode="rgb_array"returns an RGB frame.Render one frame through the env-facing interactive playback contract.
resolve_play_render_plan(*, ...)Resolve high-level playback mode through the backend contract.
run_playback(*, initialize, step, num_steps)Execute playback through the backend contract.
run_playback_mode(*, play_render_mode, ...)Resolve configured playback mode and execute it through the backend contract.
step(actions)Step the environment with given actions, return new state
Attributes
Action space
The configuration of the environment
return the size of the env if it is vectorized
Map from observation group name to its dimension.
Observation space
Return env-facing play/render capabilities.
Current environment state (None before first reset)
- property play_capabilities: EnvPlayCapabilities¶
Return env-facing play/render capabilities.
- resolve_play_render_plan(*, play_render_mode, play_steps, output_video)[source]¶
Resolve high-level playback mode through the backend contract.
- run_playback(*, initialize, step, num_steps, output_video=None, render_spacing=None, render_offset_mode=None, headless=None, record_video=None, frame_state_getter=None, camera_kwargs=None, debug_overlay_getter=None, on_frame=None)[source]¶
Execute playback through the backend contract.
debug_overlay_getterreturns per-env sequences ofunisim.backend.base.DebugPrimitivewith env-local poses (Nonedisables overlays for the frame).on_frameis an optional(frame_index, frame) -> frame | Nonecallback applied to each recorded frame before it is written to the video.
- run_playback_mode(*, play_render_mode, play_steps, output_video, initialize, step, render_spacing=None, render_offset_mode=None, frame_state_getter=None, camera_kwargs=None, debug_overlay_getter=None, on_frame=None, on_plan=None)[source]¶
Resolve configured playback mode and execute it through the backend contract.
Overlay gating follows the resolved plan mode:
recordplayback requiresplay_capabilities.supports_debug_overlay(backends fail closed otherwise);interactiveplayback requiressupports_interactive_debug_overlay— when the backend lacks it the getter is dropped with a warning so interactive playback still runs without overlays.
- abstract property obs_groups_spec: dict[str, int]¶
Map from observation group name to its dimension.
- init_play_renderer(render_spacing=None, render_offset_mode=None, *, headless=False, capture=False, width=1280, height=720, camera_kwargs=None)[source]¶
Initialize env-facing playback rendering when supported.
- render(mode='rgb_array')[source]¶
Render the current state;
mode="rgb_array"returns an RGB frame.Convenience wrapper over
init_play_renderer()andcapture_play_video_frame(), gated onplay_capabilities.supports_native_video_capture.
- render_play_frame()[source]¶
Render one frame through the env-facing interactive playback contract.
- Return type:
- capture_play_video_frame()[source]¶
Capture one RGB frame through the env-facing video contract.
- Return type:
- get_physics_state_snapshot()[source]¶
Return a physics snapshot for offline playback/video export.
- Return type: