unilab.envs.locomotion.go2w.joystick

Functions

build_go2w_backend_reset_randomization(env, ...)

Build reset DR payloads that are valid for a motor-actuator Go2W model.

sample_go2w_reset_yaw(domain_rand, num_reset)

Classes

Go2WDomainRandConfig

Go2WDomainRandConfig(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_init_yaw: 'bool' = True, init_z_range: 'list[float]' = <factory>, init_roll_range: 'list[float]' = <factory>, init_pitch_range: 'list[float]' = <factory>, init_yaw_range: 'list[float]' = <factory>, randomize_kp: 'bool' = True, kp_multiplier_range: 'list[float]' = <factory>, randomize_kd: 'bool' = True, kd_multiplier_range: 'list[float]' = <factory>)

Go2WJoystickCfg

Go2WJoystickCfg(scene: 'SceneCfg' = <factory>, sim_dt: 'float' = 0.005, 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: 'JoystickSensor' = <factory>, asset: 'Asset' = <factory>, init_state: 'InitState' = <factory>, commands: 'Commands' = <factory>, reward_config: 'RewardConfig | None' = None, domain_rand: 'Go2WDomainRandConfig' = <factory>)

Go2WJoystickDomainRandomizationProvider

Go2WJoystickEnv

InitState

InitState()

JoystickSensor

JoystickSensor()

RewardConfig

RewardConfig(scales: 'dict[str, float]', tracking_sigma: 'float', base_height_target: 'float', only_positive_rewards: 'bool' = False, 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)

class unilab.envs.locomotion.go2w.joystick.InitState[source]

Bases: object

InitState()

pos = [0.0, 0.0, 0.42]
__init__()
class unilab.envs.locomotion.go2w.joystick.Go2WDomainRandConfig[source]

Bases: DomainRandConfig

Go2WDomainRandConfig(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_init_yaw: ‘bool’ = True, init_z_range: ‘list[float]’ = <factory>, init_roll_range: ‘list[float]’ = <factory>, init_pitch_range: ‘list[float]’ = <factory>, init_yaw_range: ‘list[float]’ = <factory>, randomize_kp: ‘bool’ = True, kp_multiplier_range: ‘list[float]’ = <factory>, randomize_kd: ‘bool’ = True, kd_multiplier_range: ‘list[float]’ = <factory>)

Parameters:
randomize_init_yaw: bool = True
init_z_range: list[float]
init_roll_range: list[float]
init_pitch_range: list[float]
init_yaw_range: list[float]
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_init_yaw=True, init_z_range=<factory>, init_roll_range=<factory>, init_pitch_range=<factory>, init_yaw_range=<factory>, randomize_kp=True, kp_multiplier_range=<factory>, randomize_kd=True, kd_multiplier_range=<factory>)
Parameters:
class unilab.envs.locomotion.go2w.joystick.RewardConfig[source]

Bases: object

RewardConfig(scales: ‘dict[str, float]’, tracking_sigma: ‘float’, base_height_target: ‘float’, only_positive_rewards: ‘bool’ = False, 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)

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

  • tracking_sigma (float)

  • base_height_target (float)

  • only_positive_rewards (bool)

  • joint_pos_penalty_stand_still_scale (float)

  • joint_pos_penalty_velocity_threshold (float)

  • joint_pos_penalty_command_threshold (float)

scales: dict[str, float]
tracking_sigma: float
base_height_target: float
only_positive_rewards: bool = False
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
__init__(scales, tracking_sigma, base_height_target, only_positive_rewards=False, joint_pos_penalty_stand_still_scale=5.0, joint_pos_penalty_velocity_threshold=0.5, joint_pos_penalty_command_threshold=0.1)
Parameters:
  • scales (dict[str, float])

  • tracking_sigma (float)

  • base_height_target (float)

  • only_positive_rewards (bool)

  • joint_pos_penalty_stand_still_scale (float)

  • joint_pos_penalty_velocity_threshold (float)

  • joint_pos_penalty_command_threshold (float)

class unilab.envs.locomotion.go2w.joystick.JoystickSensor[source]

Bases: object

JoystickSensor()

local_linvel = 'local_linvel'
gyro = 'gyro'
gravity = 'upvector'
__init__()
class unilab.envs.locomotion.go2w.joystick.Go2WJoystickCfg[source]

Bases: Go2WBaseCfg

Go2WJoystickCfg(scene: ‘SceneCfg’ = <factory>, sim_dt: ‘float’ = 0.005, 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: ‘JoystickSensor’ = <factory>, asset: ‘Asset’ = <factory>, init_state: ‘InitState’ = <factory>, commands: ‘Commands’ = <factory>, reward_config: ‘RewardConfig | None’ = None, domain_rand: ‘Go2WDomainRandConfig’ = <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 (JoystickSensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (Commands)

  • reward_config (RewardConfig | None)

  • domain_rand (Go2WDomainRandConfig)

max_episode_seconds: float = 20.0
init_state: InitState
commands: Commands
reward_config: RewardConfig | None = None
sensor: JoystickSensor
domain_rand: Go2WDomainRandConfig
__init__(scene=<factory>, sim_dt=0.005, 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>)
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 (JoystickSensor)

  • asset (Asset)

  • init_state (InitState)

  • commands (Commands)

  • reward_config (RewardConfig | None)

  • domain_rand (Go2WDomainRandConfig)

unilab.envs.locomotion.go2w.joystick.build_go2w_backend_reset_randomization(env, num_reset)[source]

Build reset DR payloads that are valid for a motor-actuator Go2W model.

kp/kd are intentionally excluded here. Go2W samples them through the same config path as Go2, but applies them inside its owner pre-step motor control.

Parameters:
Return type:

ResetRandomizationPayload | None

unilab.envs.locomotion.go2w.joystick.sample_go2w_reset_yaw(domain_rand, num_reset)[source]
Parameters:
Return type:

ndarray

class unilab.envs.locomotion.go2w.joystick.Go2WJoystickDomainRandomizationProvider[source]

Bases: LocomotionDRProvider

validate(env, capabilities)[source]
Parameters:
Return type:

None

build_interval_randomization_plan(env, step_counter)[source]
Parameters:
  • env (Any)

  • step_counter (int)

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

ResetPlan

class unilab.envs.locomotion.go2w.joystick.Go2WJoystickEnv[source]

Bases: Go2WBaseEnv

Parameters:

cfg (Go2WJoystickCfg)

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

cfg (Go2WJoystickCfg)

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]

sample_reset_motor_gains(num_reset)[source]
Parameters:

num_reset (int)

Return type:

tuple[ndarray, ndarray]

set_motor_gains(env_ids, kp, kd)[source]
Parameters:
Return type:

None

apply_action(actions, state)[source]

子类实现:action → ctrl

Parameters:
Return type:

ndarray

update_state(state)[source]

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

Parameters:

state (NpEnvState)

Return type:

NpEnvState