unilab.tasks.locomotion.g1.manager_terms

Task-owned Manager-Based terms for G1 biped locomotion.

The equations come from UniLab’s legacy G1Walk joystick tasks. The adaptation uses community func + params terms, NumPy, cached cold-path sensor bindings, and the base-owned entity facade; hot paths never parse assets or probe backend privates.

Functions

compute_feet_phase_contact_targets(...)

Expected per-foot contact flags derived from the Bézier height targets.

compute_feet_phase_height_targets(...)

Cubic-Bézier per-foot height targets, ported from the legacy G1 task.

make_g1_walk_env(cfg[, num_envs, backend_type])

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

upper_body_pose(env, pose_weights[, asset_cfg])

Weighted L2 pose penalty with the twelve leg joints zeroed out.

weighted_pose(env, pose_weights[, asset_cfg])

Weighted L2 penalty for joint position deviation from the default pose.

Classes

G1GaitPhase

Two-foot gait phase observation in radians, with per-reset phase sampling.

G1PenaltyCurriculum

Scale negative-weight reward terms by average episode length.

G1VelocityCommand

G1VelocityCommandCfg

G1 velocity command with the legacy planar-norm dead zone.

G1WalkManagerBasedEnv

Manager-Based G1 walk runtime.

feet_air_time

Count feet whose current air time sits inside the rewarded window.

feet_double_stance

Penalize double-stance contact while a forward command is active.

feet_phase

Reward gait phase tracking by encouraging the expected swing-foot height.

feet_phase_contact

Reward foot contact matching the expected stance phase of the gait.

feet_phase_contrast

Reward left/right foot-height contrast against the gait-phase targets.

forward_progress

Reward forward progress relative to commanded speed.

g1_tilt_exceeded

Terminate when the base tilt from upright exceeds max_tilt_deg.

penalty_close_feet_xy

Penalty for feet closer than threshold in the horizontal plane.

penalty_feet_ori

Penalty for non-flat foot orientations (roll/pitch quaternion rows).

under_speed

Penalty for being below commanded forward speed.

class unilab.tasks.locomotion.g1.manager_terms.G1GaitPhase[source]

Bases: ManagerTermBase

Two-foot gait phase observation in radians, with per-reset phase sampling.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (_G1Env)

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

  • env (_G1Env)

reset(env_ids=None)[source]

Resets the manager term.

Parameters:

env_ids (ndarray | slice | None)

Return type:

None

class unilab.tasks.locomotion.g1.manager_terms.G1PenaltyCurriculum[source]

Bases: ManagerTermBase

Scale negative-weight reward terms by average episode length.

Ports the legacy G1 penalty curriculum: penalty weights start at initial_scale of their configured value and relax toward max_scale as the tracked average episode length crosses the configured thresholds.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (_G1Env)

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

  • env (_G1Env)

class unilab.tasks.locomotion.g1.manager_terms.G1VelocityCommand[source]

Bases: UniformVelocityCommand

Parameters:
cfg: G1VelocityCommandCfg
__init__(cfg, env)[source]
Parameters:
class unilab.tasks.locomotion.g1.manager_terms.G1VelocityCommandCfg[source]

Bases: UniformVelocityCommandCfg

G1 velocity command with the legacy planar-norm dead zone.

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)

  • planar_dead_zone (float)

planar_dead_zone: float = 0.2
build(env)[source]

Build the command term from this config.

Parameters:

env (ManagerBasedRlEnv)

Return type:

G1VelocityCommand

__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>, planar_dead_zone=0.2)
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)

  • planar_dead_zone (float)

class unilab.tasks.locomotion.g1.manager_terms.G1WalkManagerBasedEnv[source]

Bases: ManagerBasedRlEnv

Manager-Based G1 walk runtime.

Parameters:
unilab.tasks.locomotion.g1.manager_terms.compute_feet_phase_contact_targets(gait_phase, swing_height)[source]

Expected per-foot contact flags derived from the Bézier height targets.

Parameters:
Return type:

tuple[ndarray, ndarray]

unilab.tasks.locomotion.g1.manager_terms.compute_feet_phase_height_targets(gait_phase, swing_height)[source]

Cubic-Bézier per-foot height targets, ported from the legacy G1 task.

Parameters:
Return type:

tuple[ndarray, ndarray]

class unilab.tasks.locomotion.g1.manager_terms.feet_air_time[source]

Bases: _FootContactTerm

Count feet whose current air time sits inside the rewarded window.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (_G1Env)

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

  • env (_G1Env)

reset(env_ids=None)[source]

Resets the manager term.

Parameters:

env_ids (ndarray | slice | None)

Return type:

None

class unilab.tasks.locomotion.g1.manager_terms.feet_double_stance[source]

Bases: _FootContactTerm

Penalize double-stance contact while a forward command is active.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (_G1Env)

class unilab.tasks.locomotion.g1.manager_terms.feet_phase[source]

Bases: _GaitRewardTerm

Reward gait phase tracking by encouraging the expected swing-foot height.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (_G1Env)

class unilab.tasks.locomotion.g1.manager_terms.feet_phase_contact[source]

Bases: _FootContactTerm

Reward foot contact matching the expected stance phase of the gait.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (_G1Env)

class unilab.tasks.locomotion.g1.manager_terms.feet_phase_contrast[source]

Bases: _GaitRewardTerm

Reward left/right foot-height contrast against the gait-phase targets.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (_G1Env)

class unilab.tasks.locomotion.g1.manager_terms.forward_progress[source]

Bases: _LinVelTerm

Reward forward progress relative to commanded speed.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

class unilab.tasks.locomotion.g1.manager_terms.g1_tilt_exceeded[source]

Bases: _UpvectorTerm

Terminate when the base tilt from upright exceeds max_tilt_deg.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

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

  • env (ManagerBasedRlEnv)

unilab.tasks.locomotion.g1.manager_terms.make_g1_walk_env(cfg, num_envs=1, backend_type='mujoco')[source]

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

Parameters:
Return type:

G1WalkManagerBasedEnv

class unilab.tasks.locomotion.g1.manager_terms.penalty_close_feet_xy[source]

Bases: _SensorTerm

Penalty for feet closer than threshold in the horizontal plane.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

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

  • env (ManagerBasedRlEnv)

class unilab.tasks.locomotion.g1.manager_terms.penalty_feet_ori[source]

Bases: _SensorTerm

Penalty for non-flat foot orientations (roll/pitch quaternion rows).

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

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

  • env (ManagerBasedRlEnv)

class unilab.tasks.locomotion.g1.manager_terms.under_speed[source]

Bases: _LinVelTerm

Penalty for being below commanded forward speed.

Parameters:
  • cfg (ManagerTermBaseCfg)

  • env (ManagerBasedRlEnv)

unilab.tasks.locomotion.g1.manager_terms.upper_body_pose(env, pose_weights, 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]

Weighted L2 pose penalty with the twelve leg joints zeroed out.

Parameters:
  • env (ManagerBasedRlEnv)

  • pose_weights (Any)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray

unilab.tasks.locomotion.g1.manager_terms.weighted_pose(env, pose_weights, 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]

Weighted L2 penalty for joint position deviation from the default pose.

Parameters:
  • env (ManagerBasedRlEnv)

  • pose_weights (Any)

  • asset_cfg (SceneEntityCfg)

Return type:

ndarray