unilab.envs.mdp

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

class unilab.envs.mdp.JointPositionAction[source]

Bases: BaseAction

Convert policy actions into entity joint-position targets.

Parameters:
cfg: JointPositionActionCfg
__init__(cfg, env)[source]
Parameters:
apply_actions()[source]
Return type:

None

class unilab.envs.mdp.JointPositionActionCfg[source]

Bases: BaseActionCfg

Configuration for joint-position control.

Parameters:
use_default_offset: bool = True
build(env)[source]

Build the action term from this config.

Parameters:

env (ManagerBasedRlEnv)

Return type:

JointPositionAction

__init__(*, entity_name, clip=None, actuator_names, scale=1.0, offset=0.0, preserve_order=False, use_default_offset=True)
Parameters:
class unilab.envs.mdp.JointEffortAction[source]

Bases: BaseAction

Control joints via effort targets.

Parameters:
apply_actions()[source]
Return type:

None

class unilab.envs.mdp.JointEffortActionCfg[source]

Bases: BaseActionCfg

Configuration for joint effort (torque) control.

Parameters:
build(env)[source]

Build the action term from this config.

Parameters:

env (ManagerBasedRlEnv)

Return type:

JointEffortAction

__init__(*, entity_name, clip=None, actuator_names, scale=1.0, offset=0.0, preserve_order=False)
Parameters:
class unilab.envs.mdp.JointVelocityAction[source]

Bases: BaseAction

Control joints via velocity targets.

Parameters:
__init__(cfg, env)[source]
Parameters:
apply_actions()[source]
Return type:

None

class unilab.envs.mdp.JointVelocityActionCfg[source]

Bases: BaseActionCfg

Configuration for joint velocity control.

Parameters:
use_default_offset: bool = True
build(env)[source]

Build the action term from this config.

Parameters:

env (ManagerBasedRlEnv)

Return type:

JointVelocityAction

__init__(*, entity_name, clip=None, actuator_names, scale=1.0, offset=0.0, preserve_order=False, use_default_offset=True)
Parameters:
class unilab.envs.mdp.LifecycleCounterRecorder[source]

Bases: RecorderTerm

Count recorder lifecycle calls without performing I/O.

Parameters:
  • cfg (RecorderTermCfg)

  • env (ManagerBasedRlEnv)

__init__(cfg, env)[source]
Parameters:
  • cfg (RecorderTermCfg)

  • env (ManagerBasedRlEnv)

record_pre_reset(env_ids)[source]

Called in env.step() before terminated environments are reset.

What is available:

  • obs_buf contains the observation from the end of the previous step (the input the agent used to choose the terminal action). It does not contain the post-action terminal observation (the state reached after applying the action), which is never computed for resetting environments.

  • action_manager.action contains the action applied during this step. This is the correct terminal action. It will be zeroed for these environments by _reset_idx immediately after this hook returns, so capture it here if you need it later.

  • reward_buf contains the reward for this terminal step.

  • reset_terminated and reset_time_outs reflect why each environment is resetting.

This is the right hook to record the terminal transition (obs_t, action_t, reward_t, done=True) for each resetting environment.

Parameters:

env_ids (ndarray) – Indices of environments that are about to be reset.

Return type:

None

record_post_reset(env_ids)[source]

Called after a reset completes with fresh observations computed.

Fires at the end of env.reset() (covering all environments on the initial call) and within env.step() for each batch of environments that terminates, after state has been overwritten and new observations computed.

At this point obs_buf[env_ids] holds the initial observation of the new episode and action_manager.action[env_ids] is zero (no action has been taken in the new episode yet).

Use this hook to initialize per-episode state or record the first observation of a new episode.

Parameters:

env_ids (ndarray) – Indices of environments that were reset.

Return type:

None

record_post_step()[source]

Called at the end of every env.step() with fresh observations.

At this point obs_buf holds the new observation for every environment and action_manager.action holds the action that was applied during this step. Exception: for environments that reset during this step, action_manager.action has been zeroed by _reset_idx and obs_buf holds the initial observation of the new episode rather than the post-action terminal observation. Use record_pre_reset to capture the terminal (obs, action) pair for those environments. Resetting environments are identified by self._env.reset_buf.

Return type:

None

class unilab.envs.mdp.RelativeJointPositionAction[source]

Bases: BaseAction

Control joints via position targets relative to current positions.

Parameters:
apply_actions()[source]
Return type:

None

class unilab.envs.mdp.RelativeJointPositionActionCfg[source]

Bases: BaseActionCfg

Joint position targets relative to the current measured position.

target = current_joint_pos + action * scale. A fixed offset has no useful meaning for this transmission and is rejected during construction.

Parameters:
build(env)[source]

Build the action term from this config.

Parameters:

env (ManagerBasedRlEnv)

Return type:

RelativeJointPositionAction

__init__(*, entity_name, clip=None, actuator_names, scale=1.0, offset=0.0, preserve_order=False)
Parameters:
class unilab.envs.mdp.UniformVelocityCommand[source]

Bases: CommandTerm

Sample planar velocity commands and update frame-dependent components.

Parameters:
cfg: UniformVelocityCommandCfg
__init__(cfg, env)[source]
Parameters:
property command: ndarray
class unilab.envs.mdp.UniformVelocityCommandCfg[source]

Bases: CommandTermCfg

Configuration for uniformly sampled planar velocity commands.

Parameters:
  • resampling_time_range (tuple[float, float])

  • debug_vis (bool)

  • entity_name (str)

  • heading_command (bool)

  • heading_control_stiffness (float)

  • rel_standing_envs (float)

  • rel_heading_envs (float)

  • rel_world_envs (float)

  • rel_forward_envs (float)

  • init_velocity_prob (float)

  • ranges (Ranges)

  • viz (VizCfg)

entity_name: str
heading_command: bool = False
heading_control_stiffness: float = 1.0
rel_standing_envs: float = 0.0
rel_heading_envs: float = 1.0
rel_world_envs: float = 0.0
rel_forward_envs: float = 0.0
init_velocity_prob: float = 0.0
class Ranges[source]

Bases: object

Ranges(lin_vel_x: ‘tuple[float, float]’, lin_vel_y: ‘tuple[float, float]’, ang_vel_z: ‘tuple[float, float]’, heading: ‘tuple[float, float] | None’ = None)

Parameters:
lin_vel_x: tuple[float, float]
lin_vel_y: tuple[float, float]
ang_vel_z: tuple[float, float]
heading: tuple[float, float] | None = None
__init__(lin_vel_x, lin_vel_y, ang_vel_z, heading=None)
Parameters:
ranges: Ranges
class VizCfg[source]

Bases: object

VizCfg(z_offset: ‘float’ = 0.2, scale: ‘float’ = 0.5)

Parameters:
z_offset: float = 0.2
scale: float = 0.5
__init__(z_offset=0.2, scale=0.5)
Parameters:
viz: VizCfg
build(env)[source]

Build the command term from this config.

Parameters:

env (ManagerBasedRlEnv)

Return type:

UniformVelocityCommand

__init__(*, resampling_time_range, debug_vis=False, entity_name, heading_command=False, heading_control_stiffness=1.0, rel_standing_envs=0.0, rel_heading_envs=1.0, rel_world_envs=0.0, rel_forward_envs=0.0, init_velocity_prob=0.0, ranges, viz=<factory>)
Parameters:
  • resampling_time_range (tuple[float, float])

  • debug_vis (bool)

  • entity_name (str)

  • heading_command (bool)

  • heading_control_stiffness (float)

  • rel_standing_envs (float)

  • rel_heading_envs (float)

  • rel_world_envs (float)

  • rel_forward_envs (float)

  • init_velocity_prob (float)

  • ranges (Ranges)

  • viz (VizCfg)

class unilab.envs.mdp.UniformPoseCommand[source]

Bases: CommandTerm

Uniformly sampled vector command held until the next resample.

Parameters:
cfg: UniformPoseCommandCfg
__init__(cfg, env)[source]
Parameters:
property command: ndarray
class unilab.envs.mdp.UniformPoseCommandCfg[source]

Bases: CommandTermCfg

Sample a fixed-width pose vector independently per dimension.

Parameters:
ranges: tuple[tuple[float, float], ...] | list[list[float]]
zero_command_prob: float = 0.0
build(env)[source]

Build the command term from this config.

Parameters:

env (ManagerBasedRlEnv)

Return type:

UniformPoseCommand

__init__(*, resampling_time_range, debug_vis=False, ranges, zero_command_prob=0.0)
Parameters:
unilab.envs.mdp.action_acc_l2(env)[source]

Penalize the second difference of raw policy actions.

Parameters:

env (ManagerBasedRlEnv)

Return type:

ndarray

unilab.envs.mdp.action_rate_l2(env)[source]

Penalize the first difference of raw policy actions.

Parameters:

env (ManagerBasedRlEnv)

Return type:

ndarray

unilab.envs.mdp.apply_body_impulse

alias of ApplyBodyImpulse

unilab.envs.mdp.base_ang_vel(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]
Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

class unilab.envs.mdp.base_ang_vel_imu_misaligned[source]

Bases: _ImuMisalignedObservation

Base angular velocity rotated by the per-env constant IMU misalignment.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

unilab.envs.mdp.base_lin_vel(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]
Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

class unilab.envs.mdp.builtin_sensor[source]

Bases: _NamedSensorObservation

Read one existing backend sensor through a cached NumPy view.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

unilab.envs.mdp.bad_orientation(env, limit_angle, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Terminate when the asset orientation exceeds limit_angle.

Parameters:
  • env (ManagerBasedRlEnv)

  • limit_angle (float)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.body_angular_velocity_penalty(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Penalize roll/pitch angular velocity of one selected body.

Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

class unilab.envs.mdp.command_curriculum[source]

Bases: object

Update a command term’s config fields and/or params based on training steps.

Command terms read their live self.cfg at resample time, so mutating the resolved term config (e.g. rel_standing_envs or ranges) takes effect on the next command resample. Stage semantics match reward_curriculum: every stage whose step has been reached is applied in order, so later stages win.

Example owner YAML:

curriculum:
  standing_envs:
    func: unilab.envs.mdp.command_curriculum
    params:
      command_name: twist
      stages:
        - {step: 0, rel_standing_envs: 0.02}
        - {step: 12000, rel_standing_envs: 0.1}
Parameters:
  • cfg (CurriculumTermCfg)

  • env (ManagerBasedRlEnv)

__init__(cfg, env)[source]
Parameters:
  • cfg (CurriculumTermCfg)

  • env (ManagerBasedRlEnv)

unilab.envs.mdp.dof_armature

alias of JointArmature

class unilab.envs.mdp.event_curriculum[source]

Bases: object

Update an event term’s params and/or config fields based on training steps.

Event terms are invoked with their live cfg.params on every apply, so staged params updates (e.g. a widened com_range) take effect on the next event application. Stage semantics match reward_curriculum.

Example owner YAML:

curriculum:
  com_range:
    func: unilab.envs.mdp.event_curriculum
    params:
      event_name: base_com
      stages:
        - {step: 0, params: {com_range: {x: [-0.003, 0.003]}}}
        - {step: 24000, params: {com_range: {x: [-0.01, 0.01]}}}
Parameters:
  • cfg (CurriculumTermCfg)

  • env (ManagerBasedRlEnv)

__init__(cfg, env)[source]
Parameters:
  • cfg (CurriculumTermCfg)

  • env (ManagerBasedRlEnv)

unilab.envs.mdp.flat_orientation_l2(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Penalize non-flat base orientation.

Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.geom_friction

alias of GeomFriction

unilab.envs.mdp.generated_commands(env, command_name)[source]
Parameters:
  • env (ManagerBasedRlEnv)

  • command_name (str)

Return type:

ndarray

unilab.envs.mdp.joint_pos_rel(env, biased=False, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]
Parameters:
  • env (ManagerBasedRlEnv)

  • biased (bool)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.joint_armature

alias of JointArmature

unilab.envs.mdp.joint_pos_limits(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Penalize joint positions if they cross the soft limits.

Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.joint_vel_rel(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]
Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.joint_vel_l2(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Penalize selected joint velocities with an L2-squared kernel.

Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.last_action(env, action_name=None)[source]
Parameters:
  • env (ManagerBasedRlEnv)

  • action_name (str | None)

Return type:

ndarray

unilab.envs.mdp.nan_detection(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Terminate environments whose entity physics state contains NaN or Inf.

mjlab checks the raw physics state (qpos/qvel/qacc) through its nan guard; the UniLab term checks the equivalent base-owned entity state (root pose and velocity, joint position and velocity) so a non-finite physics state terminates the episode explicitly instead of relying on the optional global nan guard.

Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.pd_gains

alias of PdGains

class unilab.envs.mdp.posture[source]

Bases: ManagerTermBase

Penalize joint deviation from default pose with a per-joint-std Gaussian kernel.

params["std"] maps joint-name regexes to per-joint standard deviations; the reward is exp(-mean(error^2 / std^2)) over the selected joints.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

__init__(cfg, env)[source]
Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

unilab.envs.mdp.push_by_setting_velocity

alias of PushBySettingVelocity

unilab.envs.mdp.randomize_body_mass_inertia

alias of RandomizeBodyMassInertia

unilab.envs.mdp.randomize_encoder_bias

alias of RandomizeEncoderBias

unilab.envs.mdp.randomize_physics_scene_gravity

alias of RandomizePhysicsSceneGravity

unilab.envs.mdp.randomize_rigid_body_com

alias of RandomizeRigidBodyCom

unilab.envs.mdp.randomize_rigid_body_mass

alias of RandomizeRigidBodyMass

unilab.envs.mdp.is_alive(env)[source]

Reward environments that have not reached a non-timeout termination.

Parameters:

env (ManagerBasedRlEnv)

Return type:

ndarray

unilab.envs.mdp.is_terminated(env)[source]

Return one for non-timeout terminations.

Parameters:

env (ManagerBasedRlEnv)

Return type:

ndarray

unilab.envs.mdp.projected_gravity(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]
Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

class unilab.envs.mdp.projected_gravity_from_sensor[source]

Bases: _NamedSensorObservation

Negate a cached 3-D up-vector sensor to obtain projected gravity.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

__init__(cfg, env)[source]
Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

class unilab.envs.mdp.projected_gravity_imu_misaligned[source]

Bases: _ImuMisalignedObservation

Projected gravity rotated by the SAME per-env IMU misalignment as the gyro.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

unilab.envs.mdp.reset_root_state_uniform(env, env_ids, pose_range, velocity_range=None, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Reset a floating root from defaults plus uniformly sampled SE(3) offsets.

This is the NumPy adaptation of the pinned mjlab event. UniLab currently has no public mocap-pose write contract, so fixed-base/mocap requests fail through the entity’s cached floating-root capability instead of falling back.

Parameters:
Return type:

None

unilab.envs.mdp.reset_scene_to_default(env, env_ids)[source]

Reset all materialized scene entities to backend default qpos/qvel.

Parameters:
Return type:

None

unilab.envs.mdp.resolve_env_ids(env, env_ids)[source]

Return concrete NumPy environment IDs, preserving community sentinel semantics.

Parameters:
Return type:

ndarray

class unilab.envs.mdp.reward_curriculum[source]

Bases: object

Update a reward term’s weight and/or params based on training steps.

Each stage specifies a step threshold and optionally a weight and/or params dict. When env.common_step_counter reaches a stage’s step, the corresponding values are applied. Later stages take precedence when multiple thresholds are reached.

Example owner YAML:

curriculum:
  action_rate_ramp:
    func: unilab.envs.mdp.reward_curriculum
    params:
      reward_name: action_rate
      stages:
        - {step: 0, weight: -0.1}
        - {step: 12000, weight: -0.4}
        - {step: 24000, weight: -1.0, params: {max_vel: 1.0}}
Parameters:
  • cfg (CurriculumTermCfg)

  • env (ManagerBasedRlEnv)

__init__(cfg, env)[source]
Parameters:
  • cfg (CurriculumTermCfg)

  • env (ManagerBasedRlEnv)

unilab.envs.mdp.root_height_below_minimum(env, minimum_height, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Terminate when the asset root height is below minimum_height.

Parameters:
  • env (ManagerBasedRlEnv)

  • minimum_height (float)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.root_height(env, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Return the world-frame root height as a scalar reward or metric term.

Parameters:
  • env (ManagerBasedRlEnv)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

class unilab.envs.mdp.termination_curriculum[source]

Bases: object

Update a termination term’s params and/or time_out based on training steps.

Each stage specifies a step threshold and optionally a params dict and/or time_out flag. When env.common_step_counter reaches a stage’s step, the values are applied. Later stages take precedence.

Example owner YAML:

curriculum:
  tilt_threshold:
    func: unilab.envs.mdp.termination_curriculum
    params:
      termination_name: tilt
      stages:
        - {step: 12000, params: {max_tilt_deg: 80.0}}
        - {step: 24000, params: {max_tilt_deg: 65.0}}
Parameters:
  • cfg (CurriculumTermCfg)

  • env (ManagerBasedRlEnv)

__init__(cfg, env)[source]
Parameters:
  • cfg (CurriculumTermCfg)

  • env (ManagerBasedRlEnv)

unilab.envs.mdp.time_out(env)[source]

Terminate when the episode length reaches its maximum.

Parameters:

env (ManagerBasedRlEnv)

Return type:

ndarray

unilab.envs.mdp.track_angular_velocity(env, std, command_name, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Reward commanded yaw rate while keeping roll/pitch rates near zero.

Parameters:
  • env (ManagerBasedRlEnv)

  • std (float)

  • command_name (str)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.track_linear_velocity(env, std, command_name, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Reward commanded base linear velocity, assuming commanded z is zero.

Parameters:
  • env (ManagerBasedRlEnv)

  • std (float)

  • command_name (str)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.envs.mdp.upright(env, std, asset_cfg=SceneEntityCfg(name='robot', joint_names=None, joint_ids=slice(None, None, None), body_names=None, body_ids=slice(None, None, None), geom_names=None, geom_ids=slice(None, None, None), site_names=None, site_ids=slice(None, None, None), actuator_names=None, actuator_ids=slice(None, None, None), tendon_names=None, tendon_ids=slice(None, None, None), camera_names=None, camera_ids=slice(None, None, None), light_names=None, light_ids=slice(None, None, None), material_names=None, material_ids=slice(None, None, None), texture_names=None, texture_ids=slice(None, None, None), pair_names=None, pair_ids=slice(None, None, None), preserve_order=False))[source]

Gaussian reward for keeping one selected body upright (mjlab upright).

The reward is exp(-||pg_xy||^2 / std^2) where pg is the world gravity vector expressed in the selected body’s link frame. Flat-ground form only: mjlab’s optional terrain-normal sensors are not ported.

Parameters:
  • env (ManagerBasedRlEnv)

  • std (float)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

class unilab.envs.mdp.variable_posture[source]

Bases: ManagerTermBase

posture with speed-dependent tolerance: standing/walking/running std maps.

The per-joint std is selected from std_standing / std_walking / std_running by the total command speed (planar norm plus yaw magnitude) against walking_threshold and running_threshold.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

__init__(cfg, env)[source]
Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

Modules

actions

Built-in action terms supported by the NumPy runtime.

commands

Built-in command terms supported by the NumPy runtime.

curriculums

Generic stage-based curriculum terms for the NumPy manager runtime.

events

Community-style reset event terms for UniLab's NumPy manager runtime.

observations

Community-style observation terms for the NumPy manager runtime.

recorders

Reusable recorder terms for the NumPy Manager-Based runtime.

rewards

Community-style reward terms for the NumPy manager runtime.

terminations

Community-style termination terms for the NumPy manager runtime.