unilab.envs.locomotion.g1.joystick

G1 joystick locomotion environments.

Functions

Classes

CurriculumConfig

CurriculumConfig(enabled: 'bool' = False, initial_scale: 'float' = 0.5, min_scale: 'float' = 0.5, max_scale: 'float' = 1.0, level_down_threshold: 'float' = 150.0, level_up_threshold: 'float' = 750.0, degree: 'float' = 0.001)

G1DomainRandConfig

G1DomainRandConfig(randomize_base_mass: 'bool' = False, added_mass_range: 'list[float]' = <factory>, randomize_body_mass: 'bool' = False, body_mass_multiplier_range: 'list[float]' = <factory>, random_com: 'bool' = False, com_offset_x: 'list[float]' = <factory>, randomize_gravity: 'bool' = False, gravity_range: 'list[list[float]]' = <factory>, randomize_ground_friction: 'bool' = False, ground_friction_multiplier_range: 'list[float]' = <factory>, randomize_dof_armature: 'bool' = False, dof_armature_multiplier_range: 'list[float]' = <factory>, push_robots: 'bool' = False, push_interval: 'int' = 750, max_force: 'list[float]' = <factory>, push_body_name: 'str | None' = None, randomize_kp: 'bool' = True, kp_multiplier_range: 'list[float]' = <factory>, randomize_kd: 'bool' = True, kd_multiplier_range: 'list[float]' = <factory>)

G1RewardConfig

G1RewardConfig(scales: 'dict[str, float]', tracking_sigma: 'float', gait_frequency: 'float', feet_phase_swing_height: 'float', feet_phase_tracking_sigma: 'float', base_height_target: 'float', min_base_height: 'float', max_tilt_deg: 'float', min_forward_speed_for_gait_reward: 'float' = 0.0, close_feet_threshold: 'float' = 0.15, pose_weights: 'list[float]' = <factory>)

G1WalkControlConfig

G1WalkControlConfig(action_scale: 'float' = 1.0, simulate_action_latency: 'bool' = False)

G1WalkDomainRandomizationProvider

G1WalkEnv

G1WalkEnvCfg

G1WalkEnvCfg(scene: 'SceneCfg' = <factory>, sim_dt: 'float' = 0.006666666666666667, max_episode_seconds: 'float' = 20.0, ctrl_dt: 'float' = 0.02, render_spacing: float = 1.0, render_offset_mode: str = 'grid', motrix_max_iterations: Optional[int] = None, post_step_forward_sensor: bool = False, control_config: 'ControlConfig' = <factory>, noise_config: 'NoiseConfig' = <factory>, sensor: 'Sensor' = <factory>, asset: 'Asset' = <factory>, init_state: 'InitState' = <factory>, commands: 'Commands' = <factory>, reward_config: 'G1RewardConfig | None' = None, domain_rand: 'G1DomainRandConfig' = <factory>, gait_phase_init_mode: 'str' = 'offset_phase', reset_base_qvel_limit: 'float' = 0.5, curriculum: 'CurriculumConfig' = <factory>)

G1WalkFlatCfg

G1WalkFlatCfg(scene: 'SceneCfg' = <factory>, sim_dt: 'float' = 0.006666666666666667, max_episode_seconds: 'float' = 20.0, ctrl_dt: 'float' = 0.02, render_spacing: float = 1.0, render_offset_mode: str = 'grid', motrix_max_iterations: Optional[int] = None, post_step_forward_sensor: bool = False, control_config: 'G1WalkControlConfig' = <factory>, noise_config: 'NoiseConfig' = <factory>, sensor: 'Sensor' = <factory>, asset: 'Asset' = <factory>, init_state: 'InitState' = <factory>, commands: 'Commands' = <factory>, reward_config: 'G1WalkRewardConfig | None' = None, domain_rand: 'G1DomainRandConfig' = <factory>, gait_phase_init_mode: 'str' = 'offset_phase', reset_base_qvel_limit: 'float' = 0.5, curriculum: 'CurriculumConfig' = <factory>)

G1WalkLegacyRewardConfig

G1WalkLegacyRewardConfig(scales: 'dict[str, float]', tracking_sigma: 'float', gait_frequency: 'float', feet_phase_swing_height: 'float', feet_phase_tracking_sigma: 'float', base_height_target: 'float', min_base_height: 'float', max_tilt_deg: 'float', min_forward_speed_for_gait_reward: 'float' = 0.0, close_feet_threshold: 'float' = 0.15, pose_weights: 'list[float]' = <factory>)

G1WalkRewardConfig

对齐 holosoma G1 walking 奖励权重。

G1WalkRoughCfg

G1WalkRoughCfg(scene: 'SceneCfg' = <factory>, sim_dt: 'float' = 0.006666666666666667, max_episode_seconds: 'float' = 20.0, ctrl_dt: 'float' = 0.02, render_spacing: float = 1.0, render_offset_mode: str = 'grid', motrix_max_iterations: Optional[int] = None, post_step_forward_sensor: bool = False, control_config: 'G1WalkControlConfig' = <factory>, noise_config: 'NoiseConfig' = <factory>, sensor: 'Sensor' = <factory>, asset: 'Asset' = <factory>, init_state: 'InitState' = <factory>, commands: 'Commands' = <factory>, reward_config: 'G1WalkRewardConfig | None' = None, domain_rand: 'G1DomainRandConfig' = <factory>, gait_phase_init_mode: 'str' = 'offset_phase', reset_base_qvel_limit: 'float' = 0.5, curriculum: 'CurriculumConfig' = <factory>)

InitState

InitState()

class unilab.envs.locomotion.g1.joystick.G1DomainRandConfig[source]

Bases: DomainRandConfig

G1DomainRandConfig(randomize_base_mass: ‘bool’ = False, added_mass_range: ‘list[float]’ = <factory>, randomize_body_mass: ‘bool’ = False, body_mass_multiplier_range: ‘list[float]’ = <factory>, random_com: ‘bool’ = False, com_offset_x: ‘list[float]’ = <factory>, randomize_gravity: ‘bool’ = False, gravity_range: ‘list[list[float]]’ = <factory>, randomize_ground_friction: ‘bool’ = False, ground_friction_multiplier_range: ‘list[float]’ = <factory>, randomize_dof_armature: ‘bool’ = False, dof_armature_multiplier_range: ‘list[float]’ = <factory>, push_robots: ‘bool’ = False, push_interval: ‘int’ = 750, max_force: ‘list[float]’ = <factory>, push_body_name: ‘str | None’ = None, randomize_kp: ‘bool’ = True, kp_multiplier_range: ‘list[float]’ = <factory>, randomize_kd: ‘bool’ = True, kd_multiplier_range: ‘list[float]’ = <factory>)

Parameters:
randomize_kp: bool = True
kp_multiplier_range: list[float]
randomize_kd: bool = True
kd_multiplier_range: list[float]
__init__(randomize_base_mass=False, added_mass_range=<factory>, randomize_body_mass=False, body_mass_multiplier_range=<factory>, random_com=False, com_offset_x=<factory>, randomize_gravity=False, gravity_range=<factory>, randomize_ground_friction=False, ground_friction_multiplier_range=<factory>, randomize_dof_armature=False, dof_armature_multiplier_range=<factory>, push_robots=False, push_interval=750, max_force=<factory>, push_body_name=None, randomize_kp=True, kp_multiplier_range=<factory>, randomize_kd=True, kd_multiplier_range=<factory>)
Parameters:
class unilab.envs.locomotion.g1.joystick.InitState[source]

Bases: object

InitState()

pos = [0.0, 0.0, 0.754]
__init__()
unilab.envs.locomotion.g1.joystick.sample_gait_phase_pairs(rng, num_samples, mode)[source]
Parameters:
  • num_samples (int)

  • mode (str)

Return type:

ndarray

unilab.envs.locomotion.g1.joystick.sample_reset_base_qvel(rng, num_samples, limit)[source]
Parameters:
Return type:

ndarray

unilab.envs.locomotion.g1.joystick.build_upper_body_pose_weights(pose_weights)[source]
Parameters:

pose_weights (list[float])

Return type:

ndarray

unilab.envs.locomotion.g1.joystick.compute_feet_phase_height_targets(gait_phase, swing_height)[source]
Parameters:
Return type:

tuple[ndarray, ndarray]

unilab.envs.locomotion.g1.joystick.compute_aggregated_foot_contact(backend, sensor_names)[source]
Parameters:
Return type:

ndarray

unilab.envs.locomotion.g1.joystick.compute_feet_phase_contact_targets(gait_phase, swing_height)[source]
Parameters:
Return type:

tuple[ndarray, ndarray]

unilab.envs.locomotion.g1.joystick.compute_forward_speed_gate(linvel, min_forward_speed)[source]
Parameters:
Return type:

ndarray

unilab.envs.locomotion.g1.joystick.compute_forward_command_mask(commands)[source]
Parameters:

commands (ndarray)

Return type:

ndarray

class unilab.envs.locomotion.g1.joystick.G1RewardConfig[source]

Bases: object

G1RewardConfig(scales: ‘dict[str, float]’, tracking_sigma: ‘float’, gait_frequency: ‘float’, feet_phase_swing_height: ‘float’, feet_phase_tracking_sigma: ‘float’, base_height_target: ‘float’, min_base_height: ‘float’, max_tilt_deg: ‘float’, min_forward_speed_for_gait_reward: ‘float’ = 0.0, close_feet_threshold: ‘float’ = 0.15, pose_weights: ‘list[float]’ = <factory>)

Parameters:
scales: dict[str, float]
tracking_sigma: float
gait_frequency: float
feet_phase_swing_height: float
feet_phase_tracking_sigma: float
base_height_target: float
min_base_height: float
max_tilt_deg: float
min_forward_speed_for_gait_reward: float = 0.0
close_feet_threshold: float = 0.15
pose_weights: list[float]
__init__(scales, tracking_sigma, gait_frequency, feet_phase_swing_height, feet_phase_tracking_sigma, base_height_target, min_base_height, max_tilt_deg, min_forward_speed_for_gait_reward=0.0, close_feet_threshold=0.15, pose_weights=<factory>)
Parameters:
class unilab.envs.locomotion.g1.joystick.G1WalkLegacyRewardConfig[source]

Bases: G1RewardConfig

G1WalkLegacyRewardConfig(scales: ‘dict[str, float]’, tracking_sigma: ‘float’, gait_frequency: ‘float’, feet_phase_swing_height: ‘float’, feet_phase_tracking_sigma: ‘float’, base_height_target: ‘float’, min_base_height: ‘float’, max_tilt_deg: ‘float’, min_forward_speed_for_gait_reward: ‘float’ = 0.0, close_feet_threshold: ‘float’ = 0.15, pose_weights: ‘list[float]’ = <factory>)

Parameters:
__init__(scales, tracking_sigma, gait_frequency, feet_phase_swing_height, feet_phase_tracking_sigma, base_height_target, min_base_height, max_tilt_deg, min_forward_speed_for_gait_reward=0.0, close_feet_threshold=0.15, pose_weights=<factory>)
Parameters:
class unilab.envs.locomotion.g1.joystick.CurriculumConfig[source]

Bases: object

CurriculumConfig(enabled: ‘bool’ = False, initial_scale: ‘float’ = 0.5, min_scale: ‘float’ = 0.5, max_scale: ‘float’ = 1.0, level_down_threshold: ‘float’ = 150.0, level_up_threshold: ‘float’ = 750.0, degree: ‘float’ = 0.001)

Parameters:
enabled: bool = False
initial_scale: float = 0.5
min_scale: float = 0.5
max_scale: float = 1.0
level_down_threshold: float = 150.0
level_up_threshold: float = 750.0
degree: float = 0.001
__init__(enabled=False, initial_scale=0.5, min_scale=0.5, max_scale=1.0, level_down_threshold=150.0, level_up_threshold=750.0, degree=0.001)
Parameters:
class unilab.envs.locomotion.g1.joystick.G1WalkEnvCfg[source]

Bases: G1BaseCfg

G1WalkEnvCfg(scene: ‘SceneCfg’ = <factory>, sim_dt: ‘float’ = 0.006666666666666667, max_episode_seconds: ‘float’ = 20.0, ctrl_dt: ‘float’ = 0.02, render_spacing: float = 1.0, render_offset_mode: str = ‘grid’, motrix_max_iterations: Optional[int] = None, post_step_forward_sensor: bool = False, control_config: ‘ControlConfig’ = <factory>, noise_config: ‘NoiseConfig’ = <factory>, sensor: ‘Sensor’ = <factory>, asset: ‘Asset’ = <factory>, init_state: ‘InitState’ = <factory>, commands: ‘Commands’ = <factory>, reward_config: ‘G1RewardConfig | None’ = None, domain_rand: ‘G1DomainRandConfig’ = <factory>, gait_phase_init_mode: ‘str’ = ‘offset_phase’, reset_base_qvel_limit: ‘float’ = 0.5, curriculum: ‘CurriculumConfig’ = <factory>)

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 (NoiseConfig)

  • sensor (Sensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (Commands)

  • reward_config (G1RewardConfig | None)

  • domain_rand (G1DomainRandConfig)

  • gait_phase_init_mode (str)

  • reset_base_qvel_limit (float)

  • curriculum (CurriculumConfig)

max_episode_seconds: float = 20.0
init_state: InitState
commands: Commands
reward_config: G1RewardConfig | None = None
domain_rand: G1DomainRandConfig
gait_phase_init_mode: str = 'offset_phase'
reset_base_qvel_limit: float = 0.5
curriculum: CurriculumConfig
__init__(scene=<factory>, sim_dt=0.006666666666666667, max_episode_seconds=20.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>, init_state=<factory>, commands=<factory>, reward_config=None, domain_rand=<factory>, gait_phase_init_mode='offset_phase', reset_base_qvel_limit=0.5, curriculum=<factory>)
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 (NoiseConfig)

  • sensor (Sensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (Commands)

  • reward_config (G1RewardConfig | None)

  • domain_rand (G1DomainRandConfig)

  • gait_phase_init_mode (str)

  • reset_base_qvel_limit (float)

  • curriculum (CurriculumConfig)

class unilab.envs.locomotion.g1.joystick.G1WalkDomainRandomizationProvider[source]

Bases: LocomotionDRProvider

Parameters:
__init__(*, base_kp=None, base_kd=None)[source]
Parameters:
class unilab.envs.locomotion.g1.joystick.G1WalkEnv[source]

Bases: G1BaseEnv

Parameters:

cfg (G1WalkEnvCfg)

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

cfg (G1WalkEnvCfg)

property obs_groups_spec: dict[str, int]

101}.

Subclasses MUST override this property.

Type:

Return observation group dimensions, e.g. {“obs”

Type:

98, “critic”

update_state(state)[source]

子类实现:计算 obs/reward/terminated

Parameters:

state (NpEnvState)

Return type:

NpEnvState

get_symmetry_obs_layouts()[source]
Return type:

dict[str, tuple[tuple[str, int], ...]]

build_symmetry_augmentation(*, device)[source]

Return an env-owned runtime symmetry adapter when the task/backend supports it.

Parameters:

device (str)

apply_action(actions, state)[source]

子类实现:action → ctrl

Parameters:
Return type:

ndarray

class unilab.envs.locomotion.g1.joystick.G1WalkControlConfig[source]

Bases: object

G1WalkControlConfig(action_scale: ‘float’ = 1.0, simulate_action_latency: ‘bool’ = False)

Parameters:
  • action_scale (float)

  • simulate_action_latency (bool)

action_scale: float = 1.0
simulate_action_latency: bool = False
__init__(action_scale=1.0, simulate_action_latency=False)
Parameters:
  • action_scale (float)

  • simulate_action_latency (bool)

class unilab.envs.locomotion.g1.joystick.G1WalkRewardConfig[source]

Bases: G1RewardConfig

对齐 holosoma G1 walking 奖励权重。

Parameters:
__init__(scales, tracking_sigma, gait_frequency, feet_phase_swing_height, feet_phase_tracking_sigma, base_height_target, min_base_height, max_tilt_deg, min_forward_speed_for_gait_reward=0.0, close_feet_threshold=0.15, pose_weights=<factory>)
Parameters:
class unilab.envs.locomotion.g1.joystick.G1WalkFlatCfg[source]

Bases: G1WalkEnvCfg

G1WalkFlatCfg(scene: ‘SceneCfg’ = <factory>, sim_dt: ‘float’ = 0.006666666666666667, max_episode_seconds: ‘float’ = 20.0, ctrl_dt: ‘float’ = 0.02, render_spacing: float = 1.0, render_offset_mode: str = ‘grid’, motrix_max_iterations: Optional[int] = None, post_step_forward_sensor: bool = False, control_config: ‘G1WalkControlConfig’ = <factory>, noise_config: ‘NoiseConfig’ = <factory>, sensor: ‘Sensor’ = <factory>, asset: ‘Asset’ = <factory>, init_state: ‘InitState’ = <factory>, commands: ‘Commands’ = <factory>, reward_config: ‘G1WalkRewardConfig | None’ = None, domain_rand: ‘G1DomainRandConfig’ = <factory>, gait_phase_init_mode: ‘str’ = ‘offset_phase’, reset_base_qvel_limit: ‘float’ = 0.5, curriculum: ‘CurriculumConfig’ = <factory>)

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 (G1WalkControlConfig)

  • noise_config (NoiseConfig)

  • sensor (Sensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (Commands)

  • reward_config (G1WalkRewardConfig | None)

  • domain_rand (G1DomainRandConfig)

  • gait_phase_init_mode (str)

  • reset_base_qvel_limit (float)

  • curriculum (CurriculumConfig)

reward_config: G1WalkRewardConfig | None = None
control_config: G1WalkControlConfig
__init__(scene=<factory>, sim_dt=0.006666666666666667, max_episode_seconds=20.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>, init_state=<factory>, commands=<factory>, reward_config=None, domain_rand=<factory>, gait_phase_init_mode='offset_phase', reset_base_qvel_limit=0.5, curriculum=<factory>)
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 (G1WalkControlConfig)

  • noise_config (NoiseConfig)

  • sensor (Sensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (Commands)

  • reward_config (G1WalkRewardConfig | None)

  • domain_rand (G1DomainRandConfig)

  • gait_phase_init_mode (str)

  • reset_base_qvel_limit (float)

  • curriculum (CurriculumConfig)

curriculum: CurriculumConfig
class unilab.envs.locomotion.g1.joystick.G1WalkRoughCfg[source]

Bases: G1WalkFlatCfg

G1WalkRoughCfg(scene: ‘SceneCfg’ = <factory>, sim_dt: ‘float’ = 0.006666666666666667, max_episode_seconds: ‘float’ = 20.0, ctrl_dt: ‘float’ = 0.02, render_spacing: float = 1.0, render_offset_mode: str = ‘grid’, motrix_max_iterations: Optional[int] = None, post_step_forward_sensor: bool = False, control_config: ‘G1WalkControlConfig’ = <factory>, noise_config: ‘NoiseConfig’ = <factory>, sensor: ‘Sensor’ = <factory>, asset: ‘Asset’ = <factory>, init_state: ‘InitState’ = <factory>, commands: ‘Commands’ = <factory>, reward_config: ‘G1WalkRewardConfig | None’ = None, domain_rand: ‘G1DomainRandConfig’ = <factory>, gait_phase_init_mode: ‘str’ = ‘offset_phase’, reset_base_qvel_limit: ‘float’ = 0.5, curriculum: ‘CurriculumConfig’ = <factory>)

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 (G1WalkControlConfig)

  • noise_config (NoiseConfig)

  • sensor (Sensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (Commands)

  • reward_config (G1WalkRewardConfig | None)

  • domain_rand (G1DomainRandConfig)

  • gait_phase_init_mode (str)

  • reset_base_qvel_limit (float)

  • curriculum (CurriculumConfig)

__init__(scene=<factory>, sim_dt=0.006666666666666667, max_episode_seconds=20.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>, init_state=<factory>, commands=<factory>, reward_config=None, domain_rand=<factory>, gait_phase_init_mode='offset_phase', reset_base_qvel_limit=0.5, curriculum=<factory>)
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 (G1WalkControlConfig)

  • noise_config (NoiseConfig)

  • sensor (Sensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (Commands)

  • reward_config (G1WalkRewardConfig | None)

  • domain_rand (G1DomainRandConfig)

  • gait_phase_init_mode (str)

  • reset_base_qvel_limit (float)

  • curriculum (CurriculumConfig)