unilab.envs

Environment public API.

unilab.envs.ManagerBasedRLEnv

alias of ManagerBasedRlEnv

unilab.envs.ManagerBasedRLEnvCfg

alias of ManagerBasedRlEnvCfg

class unilab.envs.ManagerBasedRlEnv[source]

Bases: NpEnv

Manager-Based API adapter that reuses the single NpEnv lifecycle.

Parameters:
is_vector_env = True
event_manager: EventManager
command_manager: CommandManager | NullCommandManager
action_manager: ActionManager
observation_manager: ObservationManager
termination_manager: TerminationManager
reward_manager: RewardManager
curriculum_manager: CurriculumManager | NullCurriculumManager
metrics_manager: MetricsManager | NullMetricsManager
recorder_manager: RecorderManager | NullRecorderManager
__init__(cfg, backend, num_envs)[source]
Parameters:
property physics_dt: float
property step_dt: float
property max_episode_length_s: float
property max_episode_length: int
property obs_groups_spec: dict[str, int]

101}.

Subclasses MUST override this property.

Type:

Return observation group dimensions, e.g. {“obs”

Type:

98, “critic”

property action_space: Space

Action space

property unwrapped: ManagerBasedRlEnv
get_playback_debug_overlays()[source]

Aggregate playback overlays from command terms that provide one.

Terms opt in by implementing playback_debug_overlay_getter(), which returns a per-frame getter following the unisim.backend.base.DebugOverlayGetter contract. The returned getter merges primitives per env across all providing terms. Returns None when no term provides an overlay.

Return type:

DebugOverlayGetter | None

init_state()[source]

Initialize environment and return initial state

Return type:

NpEnvState

step(actions)[source]

Step the environment with given actions, return new state

Parameters:

actions (ndarray)

Return type:

NpEnvState

apply_action(actions, state)[source]

Subclasses implement the action-to-control conversion.

Parameters:
Return type:

ndarray

update_state(state)[source]

Subclasses compute observation, reward, and termination state.

Parameters:

state (NpEnvState)

Return type:

NpEnvState

reset(env_indices=None, *, seed=None, env_ids=None, options=None)[source]
Parameters:
Return type:

tuple[dict[str, ndarray], dict[str, Any]]

get_observations()[source]
Return type:

dict[str, ndarray]

set_episode_length_buf(values)[source]

Overwrite per-env episode counters (cold path, runner-init only).

episode_length_buf mirrors state.info["steps"]: each step writes info["steps"] + 1 into the buffer and reset() zeroes both, so a direct assignment must update the two together. RL runners (e.g. RSL-RL init_at_random_ep_len) call this once before learning starts to stagger initial episode lengths across envs.

Parameters:

values (ndarray)

Return type:

None

seed(seed=-1)[source]
Parameters:

seed (int)

Return type:

int

import_training_state(state)[source]

Restore the authoritative counter and its manager-derived counters.

Parameters:

state (Mapping[str, Any])

Return type:

None

close()[source]

Close the environment and release backend-owned scene assets.

Return type:

None

class unilab.envs.ManagerBasedRlEnvCfg[source]

Bases: EnvCfg

Configuration for the manager-based NumPy environment.

Production task owners declare these fields in Hydra. The Registry materializes them into this plain typed config on the cold path; Python factories do not mirror task-specific manager or term declarations.

Parameters:
observations: dict[str, ObservationGroupCfg | None]
actions: dict[str, ActionTermCfg | None]
events: dict[str, EventTermCfg | None]
rewards: dict[str, RewardTermCfg | None]
terminations: dict[str, TerminationTermCfg | None]
commands: dict[str, CommandTermCfg | None]
curriculum: dict[str, CurriculumTermCfg | None]
metrics: dict[str, MetricsTermCfg | None]
recorders: dict[str, RecorderTermCfg | None]
seed: int | None = None
is_finite_horizon: bool = False
auto_reset: bool = True
scale_rewards_by_dt: bool = True
policy_observation_group: str = 'policy'
critic_observation_group: str | None = None
validate()[source]

validate the config

Return type:

None

__init__(scene=None, sim_dt=0.01, max_episode_seconds=None, ctrl_dt=0.01, render_spacing=1.0, render_offset_mode='grid', drake_backend_mode='batch', drake_nthread=0, superdex_num_workers=0, superdex_execution_mode='batch', superdex_assets_root=None, superdex_effort_limits=None, superdex_allow_contact_approximation=False, motrix_max_iterations=None, post_step_forward_sensor=False, adaptive_chunk_size=True, chunk_size=None, cpu_ids=None, mjwarp_nconmax=None, mjwarp_njmax=None, newton_device=None, newton_nconmax=None, newton_njmax=None, newton_capacity_check_steps=1, isaacgym_device_id=None, isaacgym_worker_timeout_s=None, genesis_device_id=None, genesis_integrator=None, genesis_constraint_solver=None, genesis_friction_cone=None, genesis_solver_iterations=None, isaacsim_device_id=None, isaacsim_worker_timeout_s=None, isaacsim_render_mode=None, isaacsim_render_width=1280, isaacsim_render_height=720, observations=<factory>, actions=<factory>, events=<factory>, rewards=<factory>, terminations=<factory>, commands=<factory>, curriculum=<factory>, metrics=<factory>, recorders=<factory>, seed=None, is_finite_horizon=False, auto_reset=True, scale_rewards_by_dt=True, policy_observation_group='policy', critic_observation_group=None)
Parameters:
unilab.envs.make_manager_based_rl_env(cfg, num_envs=1, backend_type='mujoco')[source]

Construct the generic Registry-owned Manager-Based production runtime.

Parameters:
Return type:

ManagerBasedRlEnv

Modules

manager_based_rl_env

Community-compatible manager lifecycle on UniLab's NumPy runtime.

mdp

Community-style built-in MDP terms for UniLab's NumPy manager runtime.