unilab.visualization.interactive_playback¶
Shared core for interactive policy playback entrypoints.
Functions
|
Return the registered backends for a task, or |
|
Build the task env override for off-policy training. |
Build the off-policy play override, including backend render intent. |
|
|
Build the policy actor selected by an off-policy owner config. |
|
Build the BackendAdapter used by play entrypoints to derive env cfg overrides. |
|
Build an |
|
Create an APPO interactive playback session. |
|
Create a playback session and load the selected policy checkpoint. |
|
Create an interactive playback session for off-policy actors. |
|
Resolve runtime device with optional user override. |
|
|
|
Extract obs_dict from env.reset(...) using the current (obs_dict, info_dict) contract. |
|
Infer the actor MLP input dim from an rsl_rl checkpoint, if detectable. |
|
Restore an off-policy play actor and its optional observation normalizer. |
|
Build a sim2sim contract preflight closure for interactive playback entrypoints. |
|
Normalize a raw checkpoint selector value; sentinel values map to |
|
Resolve body indices used by motion-target and reward-debug overlays. |
|
Resolve the actor implementation and model kwargs used by off-policy play. |
|
|
|
|
Classes
Mutable |
|
Cold-path selection of task bodies used by playback overlays. |
|
Direct env stepping session for SAC-style off-policy actors. |
|
Scalar play arguments shared by interactive playback entrypoints. |
|
Viewer-independent playback control state. |
|
Viewer-facing session contract shared by all policy families. |
|
Configuration needed to bootstrap an RSL-RL interactive playback session. |
|
Policy/action stepping core shared by native and web viewers. |
- class unilab.visualization.interactive_playback.KeyboardCommander[source]¶
Bases:
objectMutable
[vx, vy, vyaw]velocity command driven by keyboard nudges.Per-axis nudges stack and are clamped to the task’s
commands.vel_limit.
- class unilab.visualization.interactive_playback.MotionOverlaySelection[source]¶
Bases:
objectCold-path selection of task bodies used by playback overlays.
- class unilab.visualization.interactive_playback.OffPolicyPlaybackSession[source]¶
Bases:
objectDirect env stepping session for SAC-style off-policy actors.
- Parameters:
- __init__(*, env, device, action_mode, actor, actor_algo_type, normalizer, num_envs, obs_extractor)[source]¶
- advance(controls)[source]¶
- Parameters:
controls (
PlaybackControls)- Return type:
- class unilab.visualization.interactive_playback.PlayInteractiveArgs[source]¶
Bases:
objectScalar play arguments shared by interactive playback entrypoints.
- Parameters:
task (
str)load_run (
str)action_mode (
str)policy_obs_mode (
str)algo_log_name (
str)show_target_bodies (
bool)show_reward_debug (
bool)target_show_axes (
bool)target_body_names (
str)target_max_bodies (
int)target_marker_radius (
float)target_axis_length (
float)target_marker_alpha (
float)reward_debug_show_velocity (
bool)reward_debug_lin_vel_scale (
float)reward_debug_ang_vel_scale (
float)reward_debug_show_connectors (
bool)reward_debug_show_global_anchor (
bool)camera_follow_body (
bool)camera_focus_body_name (
str)camera_height_offset (
float)use_env_visual_model (
bool)speed (
float)start_paused (
bool)keyboard (
bool)keyboard_step_lin (
float)keyboard_step_ang (
float)require_keyboard_command_obs (
bool)algo (
str)sim (
str)
- __init__(task, load_run, checkpoint, action_mode, policy_obs_mode, algo_log_name, log_root, show_target_bodies, show_reward_debug, target_show_axes, target_body_names, target_max_bodies, target_marker_radius, target_axis_length, target_marker_alpha, reward_debug_show_velocity, reward_debug_lin_vel_scale, reward_debug_ang_vel_scale, reward_debug_show_connectors, reward_debug_show_global_anchor, camera_follow_body, camera_focus_body_name, camera_height_offset, camera_distance, camera_elevation, camera_azimuth, use_env_visual_model, speed, start_paused, keyboard=False, keyboard_step_lin=0.1, keyboard_step_ang=0.2, require_keyboard_command_obs=True, algo='ppo', sim='mujoco')¶
- Parameters:
task (
str)load_run (
str)action_mode (
str)policy_obs_mode (
str)algo_log_name (
str)show_target_bodies (
bool)show_reward_debug (
bool)target_show_axes (
bool)target_body_names (
str)target_max_bodies (
int)target_marker_radius (
float)target_axis_length (
float)target_marker_alpha (
float)reward_debug_show_velocity (
bool)reward_debug_lin_vel_scale (
float)reward_debug_ang_vel_scale (
float)reward_debug_show_connectors (
bool)reward_debug_show_global_anchor (
bool)camera_follow_body (
bool)camera_focus_body_name (
str)camera_height_offset (
float)use_env_visual_model (
bool)speed (
float)start_paused (
bool)keyboard (
bool)keyboard_step_lin (
float)keyboard_step_ang (
float)require_keyboard_command_obs (
bool)algo (
str)sim (
str)
- class unilab.visualization.interactive_playback.PlaybackControls[source]¶
Bases:
objectViewer-independent playback control state.
- class unilab.visualization.interactive_playback.PlaybackSession[source]¶
Bases:
ProtocolViewer-facing session contract shared by all policy families.
- advance(controls)[source]¶
- Parameters:
controls (
PlaybackControls)- Return type:
- __init__(*args, **kwargs)¶
- class unilab.visualization.interactive_playback.RslRlPlaybackConfig[source]¶
Bases:
objectConfiguration needed to bootstrap an RSL-RL interactive playback session.
- Parameters:
- __init__(task, load_run, checkpoint, action_mode, policy_obs_mode, algo_log_name, log_root, num_envs=1, speed=1.0, start_paused=False)¶
- class unilab.visualization.interactive_playback.RslRlPlaybackSession[source]¶
Bases:
objectPolicy/action stepping core shared by native and web viewers.
- Parameters:
- __init__(*, env, wrapped_env, device, action_mode, policy, num_envs, runner=None, actor=None)[source]¶
- advance(controls)[source]¶
- Parameters:
controls (
PlaybackControls)- Return type:
- unilab.visualization.interactive_playback.available_backends_for_task(task_name)[source]¶
Return the registered backends for a task, or
()when unknown.
- unilab.visualization.interactive_playback.build_play_backend_adapter(cfg, *, root_dir, algo_name='ppo')[source]¶
Build the BackendAdapter used by play entrypoints to derive env cfg overrides.
- unilab.visualization.interactive_playback.build_playback_config(args, *, num_envs=1)[source]¶
Build an
RslRlPlaybackConfigfrom a play-args-like object.- Parameters:
- Return type:
- unilab.visualization.interactive_playback.create_appo_playback_session(*, playback_cfg, cfg, rl_cfg, env_factory, root_dir, device, wrapper_cls, log=<built-in function print>)[source]¶
Create an APPO interactive playback session.
- unilab.visualization.interactive_playback.create_rsl_rl_playback_session(*, playback_cfg, env_factory, algo_config, root_dir, device, checkpoint_resolver, checkpoint_input_dim_reader, entrypoint_log_root, wrapper_cls, runner_cls, policy_obs_dims_getter, train_cfg_normalizer, sim2sim_preflight=None, runner_loader=None, guard_algo_name=None, log=<built-in function print>)[source]¶
Create a playback session and load the selected policy checkpoint.
- unilab.visualization.interactive_playback.create_sac_playback_session(*, playback_cfg, cfg, env_factory, root_dir, device, algo_name='sac', log=<built-in function print>)[source]¶
Create an interactive playback session for off-policy actors.
- unilab.visualization.interactive_playback.infer_checkpoint_actor_input_dim(ckpt_path)[source]¶
Infer the actor MLP input dim from an rsl_rl checkpoint, if detectable.
- unilab.visualization.interactive_playback.make_sim2sim_preflight(cfg, *, algo_name)[source]¶
Build a sim2sim contract preflight closure for interactive playback entrypoints.
Returns
Nonewhen no Hydra config is available (legacy non-Hydra path). Old runs without a contract snapshot keep the fallback + warning semantics ofresolve_sim2sim_config().
- unilab.visualization.interactive_playback.normalize_checkpoint_value(value)[source]¶
Normalize a raw checkpoint selector value; sentinel values map to
None.