unilab.envs.locomotion.go2.rough¶
Classes
Go2JoystickRoughCfg(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: 'Go2DomainRandConfig' = <factory>, terrain_curriculum: 'TerrainCurriculumCfg' = <factory>, terrain_scan: 'HeightScanConfig' = <factory>, termination_config: 'RoughTerminationConfig' = <factory>) |
|
Go2RoughTerrainCfg(*, 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(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(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() |
|
RoughRewardConfig(scales: 'dict[str, float]', tracking_sigma: 'float', base_height_target: 'float', target_foot_height: 'float' = 0.1, 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' = np.float64(0.7071067811865476), feet_gait_max_err: 'float' = 0.2, feet_gait_velocity_threshold: 'float' = 0.5, feet_gait_command_threshold: 'float' = 0.1) |
|
RoughTerminationConfig(terrain_out_of_bounds: 'bool' = True, terrain_distance_buffer: 'float' = 3.0) |
- class unilab.envs.locomotion.go2.rough.Go2JoystickRoughCfg[source]¶
Bases:
Go2JoystickCfgGo2JoystickRoughCfg(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: ‘Go2DomainRandConfig’ = <factory>, terrain_curriculum: ‘TerrainCurriculumCfg’ = <factory>, terrain_scan: ‘HeightScanConfig’ = <factory>, termination_config: ‘RoughTerminationConfig’ = <factory>)
- Parameters:
scene (SceneCfg)
sim_dt (float)
max_episode_seconds (float)
ctrl_dt (float)
render_spacing (
float)render_offset_mode (
str)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 (Go2DomainRandConfig)
terrain_curriculum (TerrainCurriculumCfg)
terrain_scan (HeightScanConfig)
termination_config (RoughTerminationConfig)
- control_config: RoughControlConfig¶
- commands: RoughCommands¶
- terrain_scan: HeightScanConfig¶
- termination_config: RoughTerminationConfig¶
- sensor: RoughJoystickSensor¶
- 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_curriculum=<factory>, terrain_scan=<factory>, termination_config=<factory>)¶
- Parameters:
scene (SceneCfg)
sim_dt (float)
max_episode_seconds (float)
ctrl_dt (float)
render_spacing (
float)render_offset_mode (
str)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 (Go2DomainRandConfig)
terrain_curriculum (TerrainCurriculumCfg)
terrain_scan (HeightScanConfig)
termination_config (RoughTerminationConfig)
- class unilab.envs.locomotion.go2.rough.Go2JoystickRoughEnv[source]¶
Bases:
Go2WalkTask- Parameters:
cfg (
Go2JoystickRoughCfg)
- __init__(cfg, num_envs=1, backend_type='mujoco')[source]¶
- Parameters:
cfg (
Go2JoystickRoughCfg)
- property obs_groups_spec: dict[str, int]¶
101}.
Subclasses MUST override this property.
- Type:
Return observation group dimensions, e.g. {“obs”
- Type:
98, “critic”
- apply_action(actions, state)[source]¶
子类实现:action → ctrl
- Parameters:
actions (
ndarray)state (
NpEnvState)
- Return type:
- update_state(state)[source]¶
子类实现:计算 obs/reward/terminated
- Parameters:
state (
NpEnvState)- Return type:
- class unilab.envs.locomotion.go2.rough.Go2RoughTerrainCfg[source]¶
Bases:
TerrainGeneratorCfgGo2RoughTerrainCfg(*, 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_scaleif 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.
-
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)¶
- class unilab.envs.locomotion.go2.rough.RoughCommands[source]¶
Bases:
CommandsRoughCommands(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:
- __init__(vel_limit=<factory>, resampling_time=10.0, heading_command=True, heading_range=<factory>, heading_control_stiffness=0.5, rel_standing_envs=0.0)¶
- class unilab.envs.locomotion.go2.rough.RoughControlConfig[source]¶
Bases:
ControlConfigRoughControlConfig(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:
- __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)¶
- class unilab.envs.locomotion.go2.rough.RoughJoystickSensor[source]¶
Bases:
JoystickSensorRoughJoystickSensor()
- 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.go2.rough.RoughRewardConfig[source]¶
Bases:
RewardConfigRoughRewardConfig(scales: ‘dict[str, float]’, tracking_sigma: ‘float’, base_height_target: ‘float’, target_foot_height: ‘float’ = 0.1, 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’ = np.float64(0.7071067811865476), feet_gait_max_err: ‘float’ = 0.2, feet_gait_velocity_threshold: ‘float’ = 0.5, feet_gait_command_threshold: ‘float’ = 0.1)
- Parameters:
tracking_sigma (
float)base_height_target (
float)target_foot_height (
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)
- __init__(scales, tracking_sigma, base_height_target, target_foot_height=0.1, 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=np.float64(0.7071067811865476), feet_gait_max_err=0.2, feet_gait_velocity_threshold=0.5, feet_gait_command_threshold=0.1)¶
- Parameters:
tracking_sigma (
float)base_height_target (
float)target_foot_height (
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)