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
Expected per-foot contact flags derived from the Bézier height targets. |
|
Cubic-Bézier per-foot height targets, ported from the legacy G1 task. |
|
|
Construct the Registry-owned G1 Manager-Based production runtime. |
|
Weighted L2 pose penalty with the twelve leg joints zeroed out. |
|
Weighted L2 penalty for joint position deviation from the default pose. |
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 legacy planar-norm dead zone. |
|
Manager-Based G1 walk runtime. |
|
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 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. |
- 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 legacy G1 penalty curriculum: 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 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:
- __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:
ManagerBasedRlEnvManager-Based G1 walk runtime.
- Parameters:
cfg (
ManagerBasedRlEnvCfg)backend (
SimBackend)num_envs (
int)
- 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, ported from the legacy G1 task.
- 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)
- 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.
- 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.