unilab.envs.locomotion.common¶
- class unilab.envs.locomotion.common.BaseNoiseConfig[source]¶
Bases:
objectBaseNoiseConfig(level: ‘float’ = 0.0, scale_joint_angle: ‘float’ = 0.03, scale_joint_vel: ‘float’ = 0.5, scale_gyro: ‘float’ = 0.2, scale_gravity: ‘float’ = 0.05, scale_linvel: ‘float’ = 0.1)
- Parameters:
- class unilab.envs.locomotion.common.Commands[source]¶
Bases:
objectCommands(vel_limit: ‘list[list[float]]’ = <factory>, resampling_time: ‘float’ = 0.0, heading_command: ‘bool’ = False, heading_range: ‘list[float]’ = <factory>, heading_control_stiffness: ‘float’ = 0.5, rel_standing_envs: ‘float’ = 0.0)
- Parameters:
- __init__(vel_limit=<factory>, resampling_time=0.0, heading_command=False, heading_range=<factory>, heading_control_stiffness=0.5, rel_standing_envs=0.0)¶
- class unilab.envs.locomotion.common.ControlConfigBase[source]¶
Bases:
objectControlConfigBase(action_scale: ‘float’ = 0.25, simulate_action_latency: ‘bool’ = False)
- class unilab.envs.locomotion.common.DomainRandConfig[source]¶
Bases:
objectDomainRandConfig(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)
- Parameters:
- __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)¶
- class unilab.envs.locomotion.common.HeightScanConfig[source]¶
Bases:
objectHeightScanConfig(enabled: ‘bool’ = True, hfield_name: ‘str’ = ‘terrain_hfield’, geom_name: ‘str’ = ‘floor’, measured_points_x: ‘list[float]’ = <factory>, measured_points_y: ‘list[float]’ = <factory>, vertical_offset: ‘float’ = 0.5, scale: ‘float’ = 5.0)
- Parameters:
- __init__(enabled=True, hfield_name='terrain_hfield', geom_name='floor', measured_points_x=<factory>, measured_points_y=<factory>, vertical_offset=0.5, scale=5.0)¶
- class unilab.envs.locomotion.common.LocomotionBaseCfg[source]¶
Bases:
EnvCfgLocomotionBaseCfg(scene: unilab.base.scene.SceneCfg | None = None, sim_dt: ‘float’ = 0.01, max_episode_seconds: Optional[float] = None, 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: ‘ControlConfigBase’ = <factory>, noise_config: ‘BaseNoiseConfig’ = <factory>, sensor: ‘Sensor’ = <factory>)
- Parameters:
- control_config: ControlConfigBase¶
- noise_config: BaseNoiseConfig¶
- sensor: Sensor¶
- sim_dt: float = 0.01¶
- ctrl_dt: float = 0.02¶
- __init__(scene=None, sim_dt=0.01, max_episode_seconds=None, 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>)¶
- Parameters:
- class unilab.envs.locomotion.common.LocomotionBaseEnv[source]¶
Bases:
NpEnvCommon base environment for locomotion tasks (G1, Go1, Go2, etc.).
- Parameters:
cfg (
LocomotionBaseCfg)backend (
SimBackend)num_envs (
int)
- __init__(cfg, backend, num_envs=1)[source]¶
- Parameters:
cfg (
LocomotionBaseCfg)backend (
SimBackend)num_envs (
int)
- apply_action(actions, state)[source]¶
子类实现:action → ctrl
- Parameters:
actions (
ndarray)state (
NpEnvState)
- Return type:
- class unilab.envs.locomotion.common.LocomotionDRProvider[source]¶
Bases:
DomainRandomizationProviderBase DR provider for locomotion joystick environments.
Shared logic: -
validate,build_interval_randomization_plan,_sample_commands-build_reset_plan(template with hooks) -build_reset_observation(template with hook)Override these hooks in subclasses: -
_get_qvel_limit— default0.5-_build_extra_info_updates— default empty dict -_compute_reset_obs— must be implemented per robot- validate(env, capabilities)[source]¶
- Parameters:
env (
Any)capabilities (
DomainRandomizationCapabilities)
- Return type:
- class unilab.envs.locomotion.common.PdControlConfig[source]¶
Bases:
ControlConfigBaseControlConfigBaseplus shared PD-actuator gains (Go1/Go2/Go2W defaults).
- class unilab.envs.locomotion.common.RewardContext[source]¶
Bases:
objectImmutable snapshot of everything reward functions may read.
Built once per
_compute_rewardcall. Shared functions access only the fields they need; robot-specific methods that still live on the environment class receive the same context viaself.- Parameters:
- __init__(info, linvel, gyro, dof_pos, num_envs=0, default_angles=<factory>, tracking_sigma=0.25, base_height_target=0.0, base_height=<factory>, gravity=None, dof_vel=None, pose_weights=None, joint_range=None, linvel_yaw=None)¶
- class unilab.envs.locomotion.common.Sensor[source]¶
Bases:
objectSensor()
- local_linvel = 'local_linvel'¶
- gyro = 'gyro'¶
- __init__()¶
- unilab.envs.locomotion.common.apply_heading_yaw_feedback(commands, base_quat, heading_commands, *, stiffness, clip=2.0)[source]¶
In-place P-control on heading error →
commands[:, 2](yaw rate).
- unilab.envs.locomotion.common.sample_heading_commands(env, num_samples)[source]¶
Uniformly sample heading targets from
env.cfg.commands.heading_range.
- unilab.envs.locomotion.common.zero_small_xy_commands(commands, *, threshold=0.2)[source]¶
Zero
commands[:, :2]in-place wherever its norm is belowthreshold.
Modules
Shared DomainRandomizationProvider for locomotion environments. |
|
Shared height-scan and terrain-bound helpers for rough locomotion envs. |
|
Shared reward functions for locomotion environments. |
|
Spawn-origin managers for locomotion envs. |