unilab.envs.manipulation.allegro_inhand.rotation

Allegro in-hand rotation environment.

Functions

build_obs_lag_history(init_obs, ...)

compute_ball_angvel(ball_quat, ...)

compute_pd_torques(targets, dof_pos, ...)

normalize_rotation_axis(rotation_axis)

sample_cached_grasps(grasp_cache, num_reset)

Classes

AllegroRotationCfg

alias of AllegroRotationPPOCfg

AllegroRotationDomainRandomizationProvider

AllegroRotationMj

alias of AllegroRotationPPO

AllegroRotationPPO

AllegroRotationPPOCfg

AllegroRotationPPOCfg(scene: 'SceneCfg' = <factory>, sim_dt: 'float' = 0.005, max_episode_seconds: 'float' = 20.0, ctrl_dt: 'float' = 0.05, render_spacing: float = 1.0, render_offset_mode: str = 'grid', motrix_max_iterations: Optional[int] = None, post_step_forward_sensor: bool = False, noise_config: 'NoiseConfig' = <factory>, control_config: 'ControlConfig' = <factory>, reward_config: 'RewardConfigPPO | None' = None, domain_rand: 'DomainRandConfig' = <factory>, rotation_axis: 'tuple[float, float, float]' = (0.0, 0.0, 1.0), grasp_cache_path: 'str' = 'caches/allegro_grasp_50k.npy', gen_grasp: 'bool' = False)

DomainRandConfig

DomainRandConfig(randomize_base_mass: 'bool' = False, added_mass_range: 'list[float]' = <factory>, random_com: 'bool' = False, com_offset_x: 'list[float]' = <factory>, randomize_gravity: 'bool' = False, gravity_range: 'list[list[float]]' = <factory>, push_robots: 'bool' = False, push_interval: 'int' = 750, max_force: 'list[float]' = <factory>, push_body_name: 'str | None' = None, joint_noise: 'float' = 0.0, ball_vel_noise: 'float' = 0.0, ball_z_offset: 'float' = 0.0)

Domain_Rand

alias of DomainRandConfig

RewardConfig

alias of RewardConfigPPO

RewardConfigPPO

RewardConfigPPO(scales: 'dict[str, float]', angvel_clip_min: 'float', angvel_clip_max: 'float', reset_z_threshold: 'float')

unilab.envs.manipulation.allegro_inhand.rotation.resolve_grasp_cache_path(cache_path)[source]

Resolve Allegro grasp cache paths using the asset-root convention.

Parameters:

cache_path (str)

Return type:

Path

unilab.envs.manipulation.allegro_inhand.rotation.normalize_rotation_axis(rotation_axis)[source]
Parameters:

rotation_axis (tuple[float, float, float])

Return type:

ndarray

unilab.envs.manipulation.allegro_inhand.rotation.compute_ball_angvel(ball_quat, prev_ball_quat, ctrl_dt)[source]
Parameters:
Return type:

ndarray

unilab.envs.manipulation.allegro_inhand.rotation.compute_pd_torques(targets, dof_pos, dof_vel, kp, kd)[source]
Parameters:
Return type:

ndarray

unilab.envs.manipulation.allegro_inhand.rotation.build_obs_lag_history(init_obs, num_lag_steps, num_obs_per_step)[source]
Parameters:
Return type:

ndarray

unilab.envs.manipulation.allegro_inhand.rotation.sample_cached_grasps(grasp_cache, num_reset)[source]
Parameters:
Return type:

tuple[ndarray, ndarray, ndarray]

class unilab.envs.manipulation.allegro_inhand.rotation.RewardConfigPPO[source]

Bases: object

RewardConfigPPO(scales: ‘dict[str, float]’, angvel_clip_min: ‘float’, angvel_clip_max: ‘float’, reset_z_threshold: ‘float’)

Parameters:
scales: dict[str, float]
angvel_clip_min: float
angvel_clip_max: float
reset_z_threshold: float
__init__(scales, angvel_clip_min, angvel_clip_max, reset_z_threshold)
Parameters:
class unilab.envs.manipulation.allegro_inhand.rotation.DomainRandConfig[source]

Bases: object

DomainRandConfig(randomize_base_mass: ‘bool’ = False, added_mass_range: ‘list[float]’ = <factory>, random_com: ‘bool’ = False, com_offset_x: ‘list[float]’ = <factory>, randomize_gravity: ‘bool’ = False, gravity_range: ‘list[list[float]]’ = <factory>, push_robots: ‘bool’ = False, push_interval: ‘int’ = 750, max_force: ‘list[float]’ = <factory>, push_body_name: ‘str | None’ = None, joint_noise: ‘float’ = 0.0, ball_vel_noise: ‘float’ = 0.0, ball_z_offset: ‘float’ = 0.0)

Parameters:
randomize_base_mass: bool = False
added_mass_range: list[float]
random_com: bool = False
com_offset_x: list[float]
randomize_gravity: bool = False
gravity_range: list[list[float]]
push_robots: bool = False
push_interval: int = 750
max_force: list[float]
push_body_name: str | None = None
joint_noise: float = 0.0
ball_vel_noise: float = 0.0
ball_z_offset: float = 0.0
__init__(randomize_base_mass=False, added_mass_range=<factory>, random_com=False, com_offset_x=<factory>, randomize_gravity=False, gravity_range=<factory>, push_robots=False, push_interval=750, max_force=<factory>, push_body_name=None, joint_noise=0.0, ball_vel_noise=0.0, ball_z_offset=0.0)
Parameters:
class unilab.envs.manipulation.allegro_inhand.rotation.AllegroRotationPPOCfg[source]

Bases: AllegroBaseCfg

AllegroRotationPPOCfg(scene: ‘SceneCfg’ = <factory>, sim_dt: ‘float’ = 0.005, max_episode_seconds: ‘float’ = 20.0, ctrl_dt: ‘float’ = 0.05, render_spacing: float = 1.0, render_offset_mode: str = ‘grid’, motrix_max_iterations: Optional[int] = None, post_step_forward_sensor: bool = False, noise_config: ‘NoiseConfig’ = <factory>, control_config: ‘ControlConfig’ = <factory>, reward_config: ‘RewardConfigPPO | None’ = None, domain_rand: ‘DomainRandConfig’ = <factory>, rotation_axis: ‘tuple[float, float, float]’ = (0.0, 0.0, 1.0), grasp_cache_path: ‘str’ = ‘caches/allegro_grasp_50k.npy’, gen_grasp: ‘bool’ = False)

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)

  • noise_config (NoiseConfig)

  • control_config (ControlConfig)

  • reward_config (RewardConfigPPO | None)

  • domain_rand (DomainRandConfig)

  • rotation_axis (tuple[float, float, float])

  • grasp_cache_path (str)

  • gen_grasp (bool)

max_episode_seconds: float = 20.0
reward_config: RewardConfigPPO | None = None
domain_rand: DomainRandConfig
rotation_axis: tuple[float, float, float] = (0.0, 0.0, 1.0)
grasp_cache_path: str = 'caches/allegro_grasp_50k.npy'
gen_grasp: bool = False
__init__(scene=<factory>, sim_dt=0.005, max_episode_seconds=20.0, ctrl_dt=0.05, render_spacing=1.0, render_offset_mode='grid', motrix_max_iterations=None, post_step_forward_sensor=False, noise_config=<factory>, control_config=<factory>, reward_config=None, domain_rand=<factory>, rotation_axis=(0.0, 0.0, 1.0), grasp_cache_path='caches/allegro_grasp_50k.npy', gen_grasp=False)
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)

  • noise_config (NoiseConfig)

  • control_config (ControlConfig)

  • reward_config (RewardConfigPPO | None)

  • domain_rand (DomainRandConfig)

  • rotation_axis (tuple[float, float, float])

  • grasp_cache_path (str)

  • gen_grasp (bool)

class unilab.envs.manipulation.allegro_inhand.rotation.AllegroRotationDomainRandomizationProvider[source]

Bases: DomainRandomizationProvider

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

None

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

  • step_counter (int)

Return type:

IntervalRandomizationPlan | None

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

ResetPlan

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

dict[str, ndarray]

class unilab.envs.manipulation.allegro_inhand.rotation.AllegroRotationPPO[source]

Bases: AllegroBaseEnv

Parameters:
__init__(cfg, num_envs=1, backend_type='mujoco')[source]
Parameters:
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

unilab.envs.manipulation.allegro_inhand.rotation.RewardConfig

alias of RewardConfigPPO

unilab.envs.manipulation.allegro_inhand.rotation.Domain_Rand

alias of DomainRandConfig

unilab.envs.manipulation.allegro_inhand.rotation.AllegroRotationCfg

alias of AllegroRotationPPOCfg

unilab.envs.manipulation.allegro_inhand.rotation.AllegroRotationMj

alias of AllegroRotationPPO