unilab.tasks.locomotion.g1.manager_terms¶
Task-owned Manager-Based terms for G1 biped locomotion.
The reward/observation equations and tuned constants are ported from UniLab’s
pre-Manager-Based G1Walk joystick task family (ported in 64c7f8b8, roadmap
#1042). The adaptation uses community func + params terms, Torch state
carriers, and cached cold-path sensor bindings; hot paths never parse assets
or probe backend privates.
Functions
Expected per-foot contact flags derived from the Bézier height targets. |
|
Cubic-Bézier per-foot height targets, from the G1Walk task family (64c7f8b8). |
|
|
Construct the Registry-owned G1 Manager-Based production runtime. |
Classes
Two-foot gait phase observation in radians, with per-reset phase sampling. |
|
Scale negative-weight reward terms by average episode length. |
|
G1 velocity command with the G1Walk-family planar-norm dead zone. |
|
Manager-Based G1 walk runtime. |
|
Own the tensor G1 command reset and skip redundant host validations. |
|
Fuse the selected-reset lifecycle for the canonical G1 walk command. |
|
Evaluate the canonical walk reward family in one tensor carrier read. |
|
Fused canonical G1 walk reward family for tensor-resident owners. |
|
Evaluate the canonical G1 walk failure terms in one carrier read. |
|
Fused canonical G1 walk timeout, tilt, and height termination. |
|
Count feet whose current air time sits inside the rewarded window. |
|
Penalize double-stance contact while a forward command is active. |
|
Reward gait phase tracking by encouraging the expected swing-foot height. |
|
Reward foot contact matching the expected stance phase of the gait. |
|
Reward left/right foot-height contrast against the gait-phase targets. |
|
Reward forward progress relative to commanded speed. |
|
Terminate when root height drops below the task threshold. |
|
Terminate when the base tilt from upright exceeds |
|
Penalty for feet closer than |
|
Penalty for non-flat foot orientations (roll/pitch quaternion rows). |
|
Penalty for being below commanded forward speed. |
|
Weighted L2 pose penalty with the twelve leg joints zeroed out. |
|
Weighted L2 penalty for joint position deviation from the default pose. |
- class unilab.tasks.locomotion.g1.manager_terms.G1GaitPhase[source]¶
Bases:
ManagerTermBaseTwo-foot gait phase observation in radians, with per-reset phase sampling.
- Parameters:
cfg (
ManagerTermBaseCfg)env (
_G1Env)
- class unilab.tasks.locomotion.g1.manager_terms.G1PenaltyCurriculum[source]¶
Bases:
ManagerTermBaseScale negative-weight reward terms by average episode length.
Ports the G1Walk task-family penalty curriculum (64c7f8b8, roadmap #1042): penalty weights start at
initial_scaleof their configured value and relax towardmax_scaleas the tracked average episode length crosses the configured thresholds.- Parameters:
cfg (
ManagerTermBaseCfg)env (
_G1Env)
- class unilab.tasks.locomotion.g1.manager_terms.G1VelocityCommand[source]¶
Bases:
UniformVelocityCommand- Parameters:
cfg (
G1VelocityCommandCfg)env (
ManagerBasedRlEnv)
- __init__(cfg, env)[source]¶
- Parameters:
cfg (
G1VelocityCommandCfg)env (
ManagerBasedRlEnv)
- class unilab.tasks.locomotion.g1.manager_terms.G1VelocityCommandCfg[source]¶
Bases:
UniformVelocityCommandCfgG1 velocity command with the G1Walk-family 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:
- __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.G1WalkResetOwner[source]¶
Bases:
ResetOwnerOwn the tensor G1 command reset and skip redundant host validations.
The walk command is sampled from bounded Torch uniforms and the G1 dead-zone write is bounded by construction. Re-running the generic full-command finite synchronization after that device-resident transaction only adds a device synchronization on the reset hot path.
- Parameters:
cfg (
G1WalkResetOwnerCfg)env (
_G1Env)
- __init__(cfg, env)[source]¶
- Parameters:
cfg (
G1WalkResetOwnerCfg)env (
_G1Env)
- class unilab.tasks.locomotion.g1.manager_terms.G1WalkResetOwnerCfg[source]¶
Bases:
ResetOwnerCfgFuse the selected-reset lifecycle for the canonical G1 walk command.
- Parameters:
-
owns_observation_reset:
bool= False¶ If True, the owner replaces
ObservationManager.resetfor the selected rows. The bypass does not cover manager-owned temporal state: delay/history buffers are not cleared, so reset rows keep their previous episode’s delay lag, step counter, and phase schedule (nothing is resampled), and the observation cache is not invalidated — acompute(update_history=False)caller between the reset and the next step reads pre-reset values. Owners enabling this bypass must reset that temporal state themselves (see the publicly exportedCircularBuffer/DelayBuffer).
- __init__(func, params=<factory>, *, command_name='twist', owns_command_reset=True, owns_action_reset=True, owns_observation_reset=False, owns_metric_reset=True)¶
- class unilab.tasks.locomotion.g1.manager_terms.G1WalkManagerBasedEnv[source]¶
Bases:
ManagerBasedRlEnvManager-Based G1 walk runtime.
- Parameters:
cfg (
ManagerBasedRlEnvCfg)backend (
SimBackend)num_envs (
int)
- class unilab.tasks.locomotion.g1.manager_terms.G1WalkRewardPack[source]¶
Bases:
ManagerTermBaseEvaluate the canonical walk reward family in one tensor carrier read.
This pack fuses the G1 owner’s state-only per-step rewards: linear/angular tracking, angular-xy and orientation penalties, action rate, weighted pose, foot-orientation penalty, and phase tracking. Equations, weights, and declaration order remain owned by
RewardManager; this owner only removes duplicate carrier reads and intermediate per-term kernel launches.- Parameters:
cfg (
G1WalkRewardPackCfg)env (
_G1Env)
- returns_transient_tensor = True¶
- __init__(cfg, env)[source]¶
- Parameters:
cfg (
G1WalkRewardPackCfg)env (
_G1Env)
- class unilab.tasks.locomotion.g1.manager_terms.G1WalkTerminationPack[source]¶
Bases:
ManagerTermBaseEvaluate the canonical G1 walk failure terms in one carrier read.
- Parameters:
cfg (
G1WalkTerminationPackCfg)env (
_G1Env)
- returns_transient_tensor = True¶
- __init__(cfg, env)[source]¶
- Parameters:
cfg (
G1WalkTerminationPackCfg)env (
_G1Env)
- class unilab.tasks.locomotion.g1.manager_terms.G1WalkTerminationPackCfg[source]¶
Bases:
TerminationTermCfgFused canonical G1 walk timeout, tilt, and height termination.
- Parameters:
- class unilab.tasks.locomotion.g1.manager_terms.G1WalkRewardPackCfg[source]¶
Bases:
RewardTermCfgFused canonical G1 walk reward family for tensor-resident owners.
- Parameters:
-
pose_weights:
tuple[float,...] = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)¶
- __init__(params=<factory>, *, func, weight, reward_pack_names=(), command_name='twist', entity_name='robot', tracking_lin_sigma=0.25, tracking_ang_sigma=0.25, gait_frequency=1.5, gait_init_mode='offset_phase', swing_height=0.09, feet_phase_sigma=0.04, min_forward_speed=0.0, pose_weights=(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0))¶
- 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.
- unilab.tasks.locomotion.g1.manager_terms.compute_feet_phase_height_targets(gait_phase, swing_height)[source]¶
Cubic-Bézier per-foot height targets, from the G1Walk task family (64c7f8b8).
- class unilab.tasks.locomotion.g1.manager_terms.feet_air_time[source]¶
Bases:
_FootContactTermCount feet whose current air time sits inside the rewarded window.
- Parameters:
cfg (
ManagerTermBaseCfg)env (
_G1Env)
- class unilab.tasks.locomotion.g1.manager_terms.feet_double_stance[source]¶
Bases:
_FootContactTermPenalize 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:
_GaitRewardTermReward 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:
_FootContactTermReward 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:
_GaitRewardTermReward 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:
_LinVelTermReward forward progress relative to commanded speed.
- Parameters:
cfg (
ManagerTermBaseCfg)env (
ManagerBasedRlEnv)
- class unilab.tasks.locomotion.g1.manager_terms.g1_tilt_exceeded[source]¶
Bases:
_UpvectorTermTerminate when the base tilt from upright exceeds
max_tilt_deg.- 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:
cfg (
ManagerBasedRlEnvCfg)num_envs (
int)backend_type (
str)
- Return type:
- class unilab.tasks.locomotion.g1.manager_terms.penalty_close_feet_xy[source]¶
Bases:
_SensorTermPenalty for feet closer than
thresholdin the horizontal plane.- Parameters:
cfg (
ManagerTermBaseCfg)env (
ManagerBasedRlEnv)
- class unilab.tasks.locomotion.g1.manager_terms.penalty_feet_ori[source]¶
Bases:
_SensorTermPenalty for non-flat foot orientations (roll/pitch quaternion rows).
- Parameters:
cfg (
ManagerTermBaseCfg)env (
ManagerBasedRlEnv)
- class unilab.tasks.locomotion.g1.manager_terms.under_speed[source]¶
Bases:
_LinVelTermPenalty for being below commanded forward speed.
- Parameters:
cfg (
ManagerTermBaseCfg)env (
ManagerBasedRlEnv)
- class unilab.tasks.locomotion.g1.manager_terms.upper_body_pose[source]¶
Bases:
weighted_poseWeighted L2 pose penalty with the twelve leg joints zeroed out.
- Parameters:
cfg (
RewardTermCfg)env (
ManagerBasedRlEnv)