unilab.envs.motion_tracking.g1.tracking_obs

G1 Whole-Body Tracking — sim2real-oriented SAC variant (task G1WBTObs).

This module registers a strict subclass of G1MotionTrackingSACEnv that adds the training-pipeline pieces needed for ONNX-on-real-G1 deployment:

  • drop deploy-unavailable channels from the actor obs (base_lin_vel, motion_anchor_pos_b);

  • per-step uniform noise on motion_anchor_ori_b (actor only);

  • proprio observation history (gyro / joint_pos_rel / dof_vel / last_actions) flattened oldest-first per term, matching the deploy-side ObservationManager when use_gym_history=false;

  • per-episode encoder bias on joint_pos_rel (actor only);

  • per-episode foot-geom friction sampled across regex-matched geoms;

  • per-episode y / z COM offsets layered on top of the existing x offset;

  • joint_acc_l2 and joint_torque_l2 reward terms.

All extensions are gated by flags on G1WBTObsCfg; the bases (G1MotionTrackingSACCfg / G1MotionTrackingSACEnv / G1MotionTrackingEnv) are untouched. Switch the pelvis IMU via the yaml env.sensor.gyro/env.sensor.upvector/env.sensor.local_linvel fields (no XML duplication required — g1.xml already exposes both IMUs).

Classes

G1WBTObsCfg

SAC whole-body tracking with sim2real obs / DR / reward extensions.

G1WBTObsDomainRandomizationProvider

Extends the SAC tracking DR provider with encoder bias, foot-geom friction, y/z COM offsets, and post-reset prev_dof_vel seeding.

G1WBTObsEnv

SAC WBT with deploy-aligned obs, proprio history, and extra DR/rewards.

ObsDomainRand

y / z COM offsets, per-episode encoder bias, foot-geom friction.

ObsNoiseConfig

Actor obs masking flags + proprio history depth.

class unilab.envs.motion_tracking.g1.tracking_obs.ObsNoiseConfig[source]

Bases: NoiseConfig

Actor obs masking flags + proprio history depth.

Defaults preserve baseline behaviour so the parent NoiseConfig remains a drop-in replacement; G1WBTObs flips the flags via its task yaml.

Parameters:
  • level (float)

  • scale_joint_angle (float)

  • scale_joint_vel (float)

  • scale_gyro (float)

  • scale_gravity (float)

  • scale_linvel (float)

  • enable_zero_linvel (bool)

  • enable_zero_anchor_pos (bool)

  • enable_anchor_ori_noise (bool)

  • scale_anchor_ori (float)

  • obs_history_length (int)

enable_zero_linvel: bool = False
enable_zero_anchor_pos: bool = False
enable_anchor_ori_noise: bool = False
scale_anchor_ori: float = 0.05
obs_history_length: int = 1
__init__(level=0.0, scale_joint_angle=0.02, scale_joint_vel=0.3, scale_gyro=0.1, scale_gravity=0.05, scale_linvel=0.1, enable_zero_linvel=False, enable_zero_anchor_pos=False, enable_anchor_ori_noise=False, scale_anchor_ori=0.05, obs_history_length=1)
Parameters:
  • level (float)

  • scale_joint_angle (float)

  • scale_joint_vel (float)

  • scale_gyro (float)

  • scale_gravity (float)

  • scale_linvel (float)

  • enable_zero_linvel (bool)

  • enable_zero_anchor_pos (bool)

  • enable_anchor_ori_noise (bool)

  • scale_anchor_ori (float)

  • obs_history_length (int)

class unilab.envs.motion_tracking.g1.tracking_obs.ObsDomainRand[source]

Bases: Domain_Rand

y / z COM offsets, per-episode encoder bias, foot-geom friction.

Parameters:
randomize_com_y: bool = False
com_offset_y: list[float]
randomize_com_z: bool = False
com_offset_z: list[float]
enable_encoder_bias: bool = False
encoder_bias_range: list[float]
randomize_geom_friction: bool = False
friction_range: list[float]
friction_geom_pattern: str = '^(left|right)_foot[1-7]_collision$'
__init__(randomize_base_mass=False, added_mass_range=<factory>, random_com=False, com_offset_x=<factory>, com_offset_y=<factory>, com_offset_z=<factory>, randomize_gravity=False, gravity_range=<factory>, push_robots=False, push_interval=750, max_force=<factory>, push_body_name=None, randomize_kp=False, kp_multiplier_range=<factory>, randomize_kd=False, kd_multiplier_range=<factory>, randomize_geom_friction=False, friction_range=<factory>, friction_geom_pattern='^(left|right)_foot[1-7]_collision$', randomize_joint_default_pos=False, joint_default_pos_range=<factory>, randomize_com_y=False, randomize_com_z=False, enable_encoder_bias=False, encoder_bias_range=<factory>)
Parameters:
class unilab.envs.motion_tracking.g1.tracking_obs.G1WBTObsCfg[source]

Bases: G1MotionTrackingSACCfg

SAC whole-body tracking with sim2real obs / DR / reward extensions.

Parameters:
  • scene (SceneCfg)

  • sim_dt (float)

  • max_episode_seconds (float)

  • ctrl_dt (float)

  • render_spacing (float)

  • render_offset_mode (str)

  • motrix_max_iterations (Optional[int])

  • post_step_forward_sensor (bool)

  • control_config (ControlConfig)

  • noise_config (ObsNoiseConfig)

  • sensor (Sensor)

  • asset (Asset)

  • motion_file (str | list[str])

  • anchor_body_name (str)

  • body_names (tuple[str, …])

  • sampling_mode (Literal[‘start’, ‘clip_start’, ‘uniform’, ‘adaptive’, ‘mixed’])

  • sampling_start_ratio (float)

  • truncate_on_clip_end (bool)

  • reward_config (RewardConfig)

  • pose_randomization (PoseRandomization)

  • velocity_randomization (VelocityRandomization)

  • domain_rand (ObsDomainRand)

  • joint_position_range (tuple[float, float])

  • anchor_pos_z_threshold (float)

  • anchor_ori_threshold (float)

  • ee_body_pos_z_threshold (float)

  • ee_body_names (tuple[str, …])

  • undesired_contact_z_threshold (float)

  • terminate_on_undesired_contacts (bool)

noise_config: ObsNoiseConfig
domain_rand: ObsDomainRand
__init__(scene=<factory>, sim_dt=0.006666666666666667, max_episode_seconds=10.0, ctrl_dt=0.02, render_spacing=1.0, render_offset_mode='grid', motrix_max_iterations=None, post_step_forward_sensor=False, control_config=<factory>, noise_config=<factory>, sensor=<factory>, asset=<factory>, motion_file='/home/admin1/ws/Eric/UniLab/src/unilab/assets/motions/g1/dance1_subject2_part.npz', anchor_body_name='torso_link', body_names=('pelvis', 'left_hip_roll_link', 'left_knee_link', 'left_ankle_roll_link', 'right_hip_roll_link', 'right_knee_link', 'right_ankle_roll_link', 'torso_link', 'left_shoulder_roll_link', 'left_elbow_link', 'left_wrist_yaw_link', 'right_shoulder_roll_link', 'right_elbow_link', 'right_wrist_yaw_link'), sampling_mode='adaptive', sampling_start_ratio=0.0, truncate_on_clip_end=False, reward_config=<factory>, pose_randomization=<factory>, velocity_randomization=<factory>, domain_rand=<factory>, joint_position_range=(-0.1, 0.1), anchor_pos_z_threshold=0.25, anchor_ori_threshold=0.8, ee_body_pos_z_threshold=0.25, ee_body_names=('left_ankle_roll_link', 'right_ankle_roll_link', 'left_wrist_yaw_link', 'right_wrist_yaw_link'), undesired_contact_z_threshold=0.05, terminate_on_undesired_contacts=False)
Parameters:
  • scene (SceneCfg)

  • sim_dt (float)

  • max_episode_seconds (float)

  • ctrl_dt (float)

  • render_spacing (float)

  • render_offset_mode (str)

  • motrix_max_iterations (Optional[int])

  • post_step_forward_sensor (bool)

  • control_config (ControlConfig)

  • noise_config (ObsNoiseConfig)

  • sensor (Sensor)

  • asset (Asset)

  • motion_file (str | list[str])

  • anchor_body_name (str)

  • body_names (tuple[str, …])

  • sampling_mode (Literal[‘start’, ‘clip_start’, ‘uniform’, ‘adaptive’, ‘mixed’])

  • sampling_start_ratio (float)

  • truncate_on_clip_end (bool)

  • reward_config (RewardConfig)

  • pose_randomization (PoseRandomization)

  • velocity_randomization (VelocityRandomization)

  • domain_rand (ObsDomainRand)

  • joint_position_range (tuple[float, float])

  • anchor_pos_z_threshold (float)

  • anchor_ori_threshold (float)

  • ee_body_pos_z_threshold (float)

  • ee_body_names (tuple[str, …])

  • undesired_contact_z_threshold (float)

  • terminate_on_undesired_contacts (bool)

class unilab.envs.motion_tracking.g1.tracking_obs.G1WBTObsDomainRandomizationProvider[source]

Bases: G1MotionTrackingDomainRandomizationProvider

Extends the SAC tracking DR provider with encoder bias, foot-geom friction, y/z COM offsets, and post-reset prev_dof_vel seeding.

Parameters:
__init__(*, base_kp=None, base_kd=None, base_geom_friction=None, foot_geom_ids=None)[source]
Parameters:
validate(env, capabilities)[source]
Parameters:
Return type:

None

build_reset_plan(env, env_ids)[source]
Parameters:
Return type:

ResetPlan

class unilab.envs.motion_tracking.g1.tracking_obs.G1WBTObsEnv[source]

Bases: G1MotionTrackingSACEnv

SAC WBT with deploy-aligned obs, proprio history, and extra DR/rewards.

All extensions live in this subclass — base classes are untouched. Flags on G1WBTObsCfg are toggled from the task yaml.

Parameters:
__init__(cfg, num_envs=1, backend_type='mujoco')[source]
Parameters: