unilab.envs.locomotion.go1.rough

Go1 joystick rough-terrain task.

Classes

Go1JoystickRoughCfg

Go1JoystickRoughCfg(scene: 'SceneCfg' = <factory>, sim_dt: 'float' = 0.01, 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: 'RoughControlConfig' = <factory>, noise_config: 'NoiseConfig' = <factory>, sensor: 'RoughJoystickSensor' = <factory>, asset: 'Asset' = <factory>, init_state: 'InitState' = <factory>, commands: 'RoughCommands' = <factory>, reward_config: 'RoughRewardConfig | None' = None, domain_rand: 'Go1RoughDomainRandConfig' = <factory>, terrain_scan: 'HeightScanConfig' = <factory>, termination_config: 'RoughTerminationConfig' = <factory>, terrain_curriculum: 'TerrainCurriculumCfg' = <factory>)

Go1JoystickRoughDomainRandomizationProvider

Go1JoystickRoughEnv

Go1RoughDomainRandConfig

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

Go1RoughTerrainCfg

Go1RoughTerrainCfg(*, seed: 'int | None' = None, curriculum: 'bool' = False, size: 'tuple[float, float]' = (8.0, 8.0), horizontal_scale: 'float' = 0.2, vertical_scale: 'float' = 0.005, border_width: 'float' = 1.0, num_rows: 'int' = 6, num_cols: 'int' = 6, sub_terrains: 'dict[str, SubTerrainCfg]' = <factory>, difficulty_range: 'tuple[float, float]' = (0.0, 1.0), add_lights: 'bool' = True)

RoughCommands

RoughCommands(vel_limit: 'list[list[float]]' = <factory>, resampling_time: 'float' = 10.0, heading_command: 'bool' = True, heading_range: 'list[float]' = <factory>, heading_control_stiffness: 'float' = 0.5, rel_standing_envs: 'float' = 0.0)

RoughControlConfig

RoughControlConfig(action_scale: 'float' = 0.25, simulate_action_latency: 'bool' = False, Kp: 'float' = 35.0, Kd: 'float' = 0.5, hip_action_scale: 'float' = 0.125, non_hip_action_scale: 'float' = 0.25, clip_actions: 'float' = 100.0)

RoughJoystickSensor

RoughJoystickSensor()

RoughRewardConfig

RoughRewardConfig(scales: 'dict[str, float]', tracking_sigma: 'float', base_height_target: 'float', stand_still_command_threshold: 'float' = 0.1, joint_pos_penalty_stand_still_scale: 'float' = 5.0, joint_pos_penalty_velocity_threshold: 'float' = 0.5, joint_pos_penalty_command_threshold: 'float' = 0.1, contact_threshold: 'float' = 1.0, contact_forces_threshold: 'float' = 100.0, feet_air_time_threshold: 'float' = 0.5, feet_height_body_target: 'float' = -0.2, feet_height_body_tanh_mult: 'float' = 2.0, feet_gait_std: 'float' = 0.7071067811865476, feet_gait_max_err: 'float' = 0.2, feet_gait_velocity_threshold: 'float' = 0.5, feet_gait_command_threshold: 'float' = 0.1)

RoughTerminationConfig

RoughTerminationConfig(terrain_out_of_bounds: 'bool' = True, terrain_distance_buffer: 'float' = 3.0)

class unilab.envs.locomotion.go1.rough.RoughControlConfig[source]

Bases: ControlConfig

RoughControlConfig(action_scale: ‘float’ = 0.25, simulate_action_latency: ‘bool’ = False, Kp: ‘float’ = 35.0, Kd: ‘float’ = 0.5, hip_action_scale: ‘float’ = 0.125, non_hip_action_scale: ‘float’ = 0.25, clip_actions: ‘float’ = 100.0)

Parameters:
hip_action_scale: float = 0.125
non_hip_action_scale: float = 0.25
clip_actions: float = 100.0
__init__(action_scale=0.25, simulate_action_latency=False, Kp=35.0, Kd=0.5, hip_action_scale=0.125, non_hip_action_scale=0.25, clip_actions=100.0)
Parameters:
class unilab.envs.locomotion.go1.rough.Go1RoughDomainRandConfig[source]

Bases: DomainRandConfig

Go1RoughDomainRandConfig(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.go1.rough.RoughCommands[source]

Bases: Commands

RoughCommands(vel_limit: ‘list[list[float]]’ = <factory>, resampling_time: ‘float’ = 10.0, heading_command: ‘bool’ = True, heading_range: ‘list[float]’ = <factory>, heading_control_stiffness: ‘float’ = 0.5, rel_standing_envs: ‘float’ = 0.0)

Parameters:
vel_limit: list[list[float]]
resampling_time: float = 10.0
heading_command: bool = True
heading_range: list[float]
__init__(vel_limit=<factory>, resampling_time=10.0, heading_command=True, heading_range=<factory>, heading_control_stiffness=0.5, rel_standing_envs=0.0)
Parameters:
class unilab.envs.locomotion.go1.rough.RoughRewardConfig[source]

Bases: RewardConfig

RoughRewardConfig(scales: ‘dict[str, float]’, tracking_sigma: ‘float’, base_height_target: ‘float’, stand_still_command_threshold: ‘float’ = 0.1, joint_pos_penalty_stand_still_scale: ‘float’ = 5.0, joint_pos_penalty_velocity_threshold: ‘float’ = 0.5, joint_pos_penalty_command_threshold: ‘float’ = 0.1, contact_threshold: ‘float’ = 1.0, contact_forces_threshold: ‘float’ = 100.0, feet_air_time_threshold: ‘float’ = 0.5, feet_height_body_target: ‘float’ = -0.2, feet_height_body_tanh_mult: ‘float’ = 2.0, feet_gait_std: ‘float’ = 0.7071067811865476, feet_gait_max_err: ‘float’ = 0.2, feet_gait_velocity_threshold: ‘float’ = 0.5, feet_gait_command_threshold: ‘float’ = 0.1)

Parameters:
  • scales (dict[str, float])

  • tracking_sigma (float)

  • base_height_target (float)

  • stand_still_command_threshold (float)

  • joint_pos_penalty_stand_still_scale (float)

  • joint_pos_penalty_velocity_threshold (float)

  • joint_pos_penalty_command_threshold (float)

  • contact_threshold (float)

  • contact_forces_threshold (float)

  • feet_air_time_threshold (float)

  • feet_height_body_target (float)

  • feet_height_body_tanh_mult (float)

  • feet_gait_std (float)

  • feet_gait_max_err (float)

  • feet_gait_velocity_threshold (float)

  • feet_gait_command_threshold (float)

stand_still_command_threshold: float = 0.1
joint_pos_penalty_stand_still_scale: float = 5.0
joint_pos_penalty_velocity_threshold: float = 0.5
joint_pos_penalty_command_threshold: float = 0.1
contact_threshold: float = 1.0
contact_forces_threshold: float = 100.0
feet_air_time_threshold: float = 0.5
feet_height_body_target: float = -0.2
feet_height_body_tanh_mult: float = 2.0
feet_gait_std: float = 0.7071067811865476
feet_gait_max_err: float = 0.2
feet_gait_velocity_threshold: float = 0.5
feet_gait_command_threshold: float = 0.1
__init__(scales, tracking_sigma, base_height_target, stand_still_command_threshold=0.1, joint_pos_penalty_stand_still_scale=5.0, joint_pos_penalty_velocity_threshold=0.5, joint_pos_penalty_command_threshold=0.1, contact_threshold=1.0, contact_forces_threshold=100.0, feet_air_time_threshold=0.5, feet_height_body_target=-0.2, feet_height_body_tanh_mult=2.0, feet_gait_std=0.7071067811865476, feet_gait_max_err=0.2, feet_gait_velocity_threshold=0.5, feet_gait_command_threshold=0.1)
Parameters:
  • scales (dict[str, float])

  • tracking_sigma (float)

  • base_height_target (float)

  • stand_still_command_threshold (float)

  • joint_pos_penalty_stand_still_scale (float)

  • joint_pos_penalty_velocity_threshold (float)

  • joint_pos_penalty_command_threshold (float)

  • contact_threshold (float)

  • contact_forces_threshold (float)

  • feet_air_time_threshold (float)

  • feet_height_body_target (float)

  • feet_height_body_tanh_mult (float)

  • feet_gait_std (float)

  • feet_gait_max_err (float)

  • feet_gait_velocity_threshold (float)

  • feet_gait_command_threshold (float)

class unilab.envs.locomotion.go1.rough.RoughJoystickSensor[source]

Bases: JoystickSensor

RoughJoystickSensor()

feet_vel = ['FL_vel', 'FR_vel', 'RL_vel', 'RR_vel']
undesired_contact = ['base1_contact', 'base2_contact', 'base3_contact', 'FL_hip_contact', 'FR_hip_contact', 'RL_hip_contact', 'RR_hip_contact', 'FL_thigh_contact', 'FR_thigh_contact', 'RL_thigh_contact', 'RR_thigh_contact', 'FL_calf_contact1', 'FR_calf_contact1', 'RL_calf_contact1', 'RR_calf_contact1', 'FL_calf_contact2', 'FR_calf_contact2', 'RL_calf_contact2', 'RR_calf_contact2']
__init__()
class unilab.envs.locomotion.go1.rough.RoughTerminationConfig[source]

Bases: object

RoughTerminationConfig(terrain_out_of_bounds: ‘bool’ = True, terrain_distance_buffer: ‘float’ = 3.0)

Parameters:
  • terrain_out_of_bounds (bool)

  • terrain_distance_buffer (float)

terrain_out_of_bounds: bool = True
terrain_distance_buffer: float = 3.0
__init__(terrain_out_of_bounds=True, terrain_distance_buffer=3.0)
Parameters:
  • terrain_out_of_bounds (bool)

  • terrain_distance_buffer (float)

class unilab.envs.locomotion.go1.rough.Go1RoughTerrainCfg[source]

Bases: TerrainGeneratorCfg

Go1RoughTerrainCfg(*, seed: ‘int | None’ = None, curriculum: ‘bool’ = False, size: ‘tuple[float, float]’ = (8.0, 8.0), horizontal_scale: ‘float’ = 0.2, vertical_scale: ‘float’ = 0.005, border_width: ‘float’ = 1.0, num_rows: ‘int’ = 6, num_cols: ‘int’ = 6, sub_terrains: ‘dict[str, SubTerrainCfg]’ = <factory>, difficulty_range: ‘tuple[float, float]’ = (0.0, 1.0), add_lights: ‘bool’ = True)

Parameters:
size: tuple[float, float] = (8.0, 8.0)

Width and length of each sub-terrain patch, in meters. Both components must be integer multiples of horizontal_scale.

num_rows: int = 6

Number of sub-terrain rows in the grid. Represents difficulty levels in curriculum mode. Note: Environments are randomly assigned to rows, so multiple envs can share the same patch.

num_cols: int = 6

Number of sub-terrain columns in the grid.

In curriculum mode the generator ignores this value and uses one column per terrain type (len(sub_terrains)). In random mode it is used as-is.

border_width: float = 1.0

Width of the flat border around the entire terrain grid, in meters. Must be an integer multiple of horizontal_scale if non-zero. The border is a flat hfield slab whose top surface is flush with the inner-terrain floor at z=0; it is NOT a wall.

add_lights: bool = True

If True, adds a directional light above the terrain grid.

horizontal_scale: float = 0.2

Heightfield grid resolution along x and y, in meters per cell. Shared by every sub-terrain (overwritten in TerrainGenerator __init__). All length-like sub-terrain parameters (step_width, platform_width, border_width, etc.) must be integer multiples of this value.

sub_terrains: dict[str, SubTerrainCfg]

Named sub-terrain configurations to populate the grid.

__init__(*, seed=None, curriculum=False, size=(8.0, 8.0), horizontal_scale=0.2, vertical_scale=0.005, border_width=1.0, num_rows=6, num_cols=6, sub_terrains=<factory>, difficulty_range=(0.0, 1.0), add_lights=True)
Parameters:
class unilab.envs.locomotion.go1.rough.Go1JoystickRoughCfg[source]

Bases: Go1JoystickCfg

Go1JoystickRoughCfg(scene: ‘SceneCfg’ = <factory>, sim_dt: ‘float’ = 0.01, 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: ‘RoughControlConfig’ = <factory>, noise_config: ‘NoiseConfig’ = <factory>, sensor: ‘RoughJoystickSensor’ = <factory>, asset: ‘Asset’ = <factory>, init_state: ‘InitState’ = <factory>, commands: ‘RoughCommands’ = <factory>, reward_config: ‘RoughRewardConfig | None’ = None, domain_rand: ‘Go1RoughDomainRandConfig’ = <factory>, terrain_scan: ‘HeightScanConfig’ = <factory>, termination_config: ‘RoughTerminationConfig’ = <factory>, terrain_curriculum: ‘TerrainCurriculumCfg’ = <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 (RoughControlConfig)

  • noise_config (NoiseConfig)

  • sensor (RoughJoystickSensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (RoughCommands)

  • reward_config (RoughRewardConfig | None)

  • domain_rand (Go1RoughDomainRandConfig)

  • terrain_scan (HeightScanConfig)

  • termination_config (RoughTerminationConfig)

  • terrain_curriculum (TerrainCurriculumCfg)

control_config: RoughControlConfig
commands: RoughCommands
terrain_scan: HeightScanConfig
termination_config: RoughTerminationConfig
terrain_curriculum: TerrainCurriculumCfg
sensor: RoughJoystickSensor
domain_rand: Go1RoughDomainRandConfig
reward_config: RoughRewardConfig | None = None
__init__(scene=<factory>, sim_dt=0.01, 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>, terrain_scan=<factory>, termination_config=<factory>, terrain_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 (RoughControlConfig)

  • noise_config (NoiseConfig)

  • sensor (RoughJoystickSensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (RoughCommands)

  • reward_config (RoughRewardConfig | None)

  • domain_rand (Go1RoughDomainRandConfig)

  • terrain_scan (HeightScanConfig)

  • termination_config (RoughTerminationConfig)

  • terrain_curriculum (TerrainCurriculumCfg)

class unilab.envs.locomotion.go1.rough.Go1JoystickRoughDomainRandomizationProvider[source]

Bases: Go1JoystickDomainRandomizationProvider

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

ResetPlan

class unilab.envs.locomotion.go1.rough.Go1JoystickRoughEnv[source]

Bases: Go1WalkTask

Parameters:

cfg (Go1JoystickRoughCfg)

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

cfg (Go1JoystickRoughCfg)

property obs_groups_spec: dict[str, int]

101}.

Subclasses MUST override this property.

Type:

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

Type:

98, “critic”

reset(env_indices)[source]
Parameters:

env_indices (ndarray)

Return type:

tuple[dict[str, ndarray], dict]

apply_action(actions, state)[source]

子类实现:action → ctrl

Parameters:
Return type:

ndarray

update_state(state)[source]

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

Parameters:

state (NpEnvState)

Return type:

NpEnvState