mani-skill-nightly 2025.10.22.143__py3-none-any.whl → 2025.10.22.157__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mani-skill-nightly might be problematic. Click here for more details.

Files changed (122) hide show
  1. mani_skill/agents/base_agent.py +20 -14
  2. mani_skill/agents/base_real_agent.py +6 -6
  3. mani_skill/agents/controllers/base_controller.py +6 -6
  4. mani_skill/agents/controllers/pd_joint_pos.py +2 -2
  5. mani_skill/agents/controllers/utils/kinematics.py +27 -12
  6. mani_skill/agents/multi_agent.py +5 -5
  7. mani_skill/agents/registration.py +3 -4
  8. mani_skill/agents/robots/allegro_hand/allegro.py +1 -2
  9. mani_skill/agents/robots/allegro_hand/allegro_touch.py +3 -3
  10. mani_skill/agents/robots/dclaw/dclaw.py +2 -3
  11. mani_skill/agents/robots/fetch/fetch.py +2 -2
  12. mani_skill/agents/robots/floating_ability_hand/floating_ability_hand.py +10 -13
  13. mani_skill/agents/robots/floating_robotiq_2f_85_gripper/floating_robotiq_2f_85_gripper.py +2 -2
  14. mani_skill/agents/robots/lerobot/manipulator.py +4 -4
  15. mani_skill/agents/robots/panda/panda_stick.py +2 -2
  16. mani_skill/agents/robots/trifingerpro/trifingerpro.py +1 -2
  17. mani_skill/agents/robots/xarm/xarm7_ability.py +2 -2
  18. mani_skill/agents/utils.py +2 -2
  19. mani_skill/envs/minimal_template.py +4 -4
  20. mani_skill/envs/sapien_env.py +32 -32
  21. mani_skill/envs/scene.py +27 -27
  22. mani_skill/envs/scenes/base_env.py +3 -3
  23. mani_skill/envs/sim2real_env.py +10 -10
  24. mani_skill/envs/tasks/control/ant.py +6 -6
  25. mani_skill/envs/tasks/control/cartpole.py +4 -4
  26. mani_skill/envs/tasks/control/hopper.py +7 -7
  27. mani_skill/envs/tasks/control/humanoid.py +20 -20
  28. mani_skill/envs/tasks/dexterity/insert_flower.py +41 -23
  29. mani_skill/envs/tasks/dexterity/rotate_single_object_in_hand.py +6 -6
  30. mani_skill/envs/tasks/dexterity/rotate_valve.py +5 -5
  31. mani_skill/envs/tasks/digital_twins/base_env.py +4 -4
  32. mani_skill/envs/tasks/digital_twins/bridge_dataset_eval/base_env.py +22 -12
  33. mani_skill/envs/tasks/digital_twins/so100_arm/grasp_cube.py +4 -4
  34. mani_skill/envs/tasks/drawing/draw.py +1 -3
  35. mani_skill/envs/tasks/drawing/draw_svg.py +6 -8
  36. mani_skill/envs/tasks/drawing/draw_triangle.py +1 -2
  37. mani_skill/envs/tasks/empty_env.py +1 -3
  38. mani_skill/envs/tasks/fmb/fmb.py +1 -2
  39. mani_skill/envs/tasks/humanoid/humanoid_pick_place.py +7 -7
  40. mani_skill/envs/tasks/humanoid/humanoid_stand.py +5 -5
  41. mani_skill/envs/tasks/humanoid/transport_box.py +4 -4
  42. mani_skill/envs/tasks/mobile_manipulation/open_cabinet_drawer.py +8 -8
  43. mani_skill/envs/tasks/mobile_manipulation/robocasa/kitchen.py +2 -3
  44. mani_skill/envs/tasks/quadruped/quadruped_reach.py +5 -5
  45. mani_skill/envs/tasks/quadruped/quadruped_spin.py +5 -5
  46. mani_skill/envs/tasks/rotate_cube.py +4 -4
  47. mani_skill/envs/tasks/tabletop/assembling_kits.py +2 -2
  48. mani_skill/envs/tasks/tabletop/lift_peg_upright.py +4 -4
  49. mani_skill/envs/tasks/tabletop/peg_insertion_side.py +4 -4
  50. mani_skill/envs/tasks/tabletop/pick_clutter_ycb.py +4 -4
  51. mani_skill/envs/tasks/tabletop/pick_cube.py +4 -4
  52. mani_skill/envs/tasks/tabletop/pick_single_ycb.py +5 -5
  53. mani_skill/envs/tasks/tabletop/place_sphere.py +4 -4
  54. mani_skill/envs/tasks/tabletop/plug_charger.py +2 -2
  55. mani_skill/envs/tasks/tabletop/poke_cube.py +4 -4
  56. mani_skill/envs/tasks/tabletop/pull_cube.py +5 -5
  57. mani_skill/envs/tasks/tabletop/pull_cube_tool.py +4 -4
  58. mani_skill/envs/tasks/tabletop/push_cube.py +6 -6
  59. mani_skill/envs/tasks/tabletop/push_t.py +4 -4
  60. mani_skill/envs/tasks/tabletop/roll_ball.py +4 -4
  61. mani_skill/envs/tasks/tabletop/stack_cube.py +4 -4
  62. mani_skill/envs/tasks/tabletop/stack_pyramid.py +44 -25
  63. mani_skill/envs/tasks/tabletop/turn_faucet.py +4 -4
  64. mani_skill/envs/tasks/tabletop/two_robot_pick_cube.py +4 -4
  65. mani_skill/envs/tasks/tabletop/two_robot_stack_cube.py +4 -4
  66. mani_skill/envs/template.py +4 -4
  67. mani_skill/envs/utils/observations/observations.py +2 -3
  68. mani_skill/envs/utils/randomization/batched_rng.py +7 -7
  69. mani_skill/envs/utils/randomization/samplers.py +2 -2
  70. mani_skill/examples/benchmarking/envs/maniskill/franka_move.py +2 -2
  71. mani_skill/examples/benchmarking/envs/maniskill/franka_pick_cube.py +2 -2
  72. mani_skill/examples/benchmarking/profiling.py +2 -2
  73. mani_skill/examples/demo_random_action.py +1 -1
  74. mani_skill/render/shaders.py +5 -5
  75. mani_skill/sensors/base_sensor.py +1 -2
  76. mani_skill/sensors/camera.py +4 -4
  77. mani_skill/utils/assets/data.py +3 -3
  78. mani_skill/utils/building/_mjcf_loader.py +11 -11
  79. mani_skill/utils/building/actor_builder.py +4 -4
  80. mani_skill/utils/building/articulation_builder.py +3 -3
  81. mani_skill/utils/building/mjcf_loader.py +6 -6
  82. mani_skill/utils/building/urdf_loader.py +6 -6
  83. mani_skill/utils/common.py +2 -2
  84. mani_skill/utils/geometry/bounding_cylinder.py +4 -4
  85. mani_skill/utils/geometry/geometry.py +1 -3
  86. mani_skill/utils/geometry/trimesh_utils.py +1 -3
  87. mani_skill/utils/gym_utils.py +2 -4
  88. mani_skill/utils/registration.py +6 -6
  89. mani_skill/utils/sapien_utils.py +21 -21
  90. mani_skill/utils/scene_builder/ai2thor/constants.py +1 -2
  91. mani_skill/utils/scene_builder/ai2thor/scene_builder.py +9 -9
  92. mani_skill/utils/scene_builder/control/planar/scene_builder.py +2 -4
  93. mani_skill/utils/scene_builder/kitchen_counter/scene_builder.py +1 -2
  94. mani_skill/utils/scene_builder/registration.py +1 -2
  95. mani_skill/utils/scene_builder/replicacad/rearrange/scene_builder.py +16 -16
  96. mani_skill/utils/scene_builder/replicacad/scene_builder.py +15 -15
  97. mani_skill/utils/scene_builder/robocasa/fixtures/windows.py +2 -4
  98. mani_skill/utils/scene_builder/robocasa/scene_builder.py +5 -5
  99. mani_skill/utils/scene_builder/scene_builder.py +15 -15
  100. mani_skill/utils/scene_builder/table/scene_builder.py +1 -2
  101. mani_skill/utils/structs/actor.py +6 -6
  102. mani_skill/utils/structs/articulation.py +32 -30
  103. mani_skill/utils/structs/articulation_joint.py +6 -6
  104. mani_skill/utils/structs/base.py +14 -9
  105. mani_skill/utils/structs/drive.py +2 -2
  106. mani_skill/utils/structs/link.py +10 -8
  107. mani_skill/utils/structs/pose.py +3 -3
  108. mani_skill/utils/structs/render_camera.py +4 -4
  109. mani_skill/utils/visualization/jupyter_utils.py +1 -3
  110. mani_skill/utils/visualization/misc.py +5 -5
  111. mani_skill/utils/wrappers/cached_reset.py +5 -3
  112. mani_skill/utils/wrappers/flatten.py +1 -2
  113. mani_skill/utils/wrappers/record.py +10 -8
  114. mani_skill/utils/wrappers/visual_encoders.py +2 -2
  115. mani_skill/vector/wrappers/gymnasium.py +23 -13
  116. mani_skill/vector/wrappers/sb3.py +5 -5
  117. {mani_skill_nightly-2025.10.22.143.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/METADATA +1 -1
  118. {mani_skill_nightly-2025.10.22.143.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/RECORD +122 -122
  119. {mani_skill_nightly-2025.10.22.143.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/WHEEL +0 -0
  120. {mani_skill_nightly-2025.10.22.143.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/licenses/LICENSE +0 -0
  121. {mani_skill_nightly-2025.10.22.143.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/licenses/LICENSE-3RD-PARTY +0 -0
  122. {mani_skill_nightly-2025.10.22.143.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  """Adapted from https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/humanoid.py"""
2
2
 
3
- from typing import Any, Dict, Union
3
+ from typing import Any, Union
4
4
 
5
5
  import numpy as np
6
6
  import sapien
@@ -118,7 +118,7 @@ class HumanoidEnvBase(BaseEnv):
118
118
  return com_vel
119
119
 
120
120
  # cache re-used computation
121
- def evaluate(self) -> Dict:
121
+ def evaluate(self) -> dict:
122
122
  return dict(
123
123
  torso_xmat=self.agent.robot.links_map[
124
124
  "torso"
@@ -186,7 +186,7 @@ class HumanoidEnvBase(BaseEnv):
186
186
  margin=_STAND_HEIGHT / 4,
187
187
  ).view(-1)
188
188
 
189
- def upright_rew(self, info: Dict):
189
+ def upright_rew(self, info: dict):
190
190
  return rewards.tolerance(
191
191
  self.torso_upright(info),
192
192
  lower=0.9,
@@ -205,7 +205,7 @@ class HumanoidEnvStandard(HumanoidEnvBase):
205
205
  def __init__(self, *args, robot_uids="humanoid", **kwargs):
206
206
  super().__init__(*args, robot_uids=robot_uids, **kwargs)
207
207
 
208
- def _get_obs_state_dict(self, info: Dict):
208
+ def _get_obs_state_dict(self, info: dict):
209
209
  # our qpos model doesn't include the free joint, meaning qpos and qvel are 21 dims, not 27
210
210
  # global dpos/dt and root (torso) dquaterion/dt are lost as result
211
211
  # we replace them with linear root linvel and root angularvel (equivalent info)
@@ -232,7 +232,7 @@ class HumanoidEnvStandard(HumanoidEnvBase):
232
232
 
233
233
  # standard humanoid env resets if torso is below a certain point
234
234
  # therefore, we disable all contacts except feet and floor
235
- def _load_scene(self, options: Dict):
235
+ def _load_scene(self, options: dict):
236
236
  super()._load_scene(options)
237
237
  self.ground.set_collision_group_bit(group=2, bit_idx=30, bit=1)
238
238
 
@@ -240,7 +240,7 @@ class HumanoidEnvStandard(HumanoidEnvBase):
240
240
  if not "foot" in link.name:
241
241
  link.set_collision_group_bit(group=2, bit_idx=30, bit=1)
242
242
 
243
- def _initialize_episode(self, env_idx: torch.Tensor, options: Dict):
243
+ def _initialize_episode(self, env_idx: torch.Tensor, options: dict):
244
244
  with torch.device(self.device):
245
245
  b = len(env_idx)
246
246
  # set agent root pose - torso now centered at dummy root at (0,0,0)
@@ -260,7 +260,7 @@ class HumanoidEnvStandard(HumanoidEnvBase):
260
260
  self.agent.robot.set_qvel(qvel_noise)
261
261
 
262
262
  # in standard (non-hard) version, we terminate early if the torso is in unacceptable range
263
- def evaluate(self) -> Dict:
263
+ def evaluate(self) -> dict:
264
264
  info = super().evaluate()
265
265
  torso_z = self.agent.robot.links_map["torso"].pose.p[:, -1]
266
266
  failure = torch.logical_or(torso_z < 0.7, torso_z > 2.0)
@@ -300,7 +300,7 @@ class HumanoidStand(HumanoidEnvStandard):
300
300
  def __init__(self, *args, robot_uids="humanoid", **kwargs):
301
301
  super().__init__(*args, robot_uids=robot_uids, **kwargs)
302
302
 
303
- def _get_obs_state_dict(self, info: Dict):
303
+ def _get_obs_state_dict(self, info: dict):
304
304
  # make all obs completely egocentric, for z rotation invariance, since stand has z rot randomization
305
305
  root_pose_mat = self.agent.robot.links_map[
306
306
  "dummy_root_0"
@@ -325,7 +325,7 @@ class HumanoidStand(HumanoidEnvStandard):
325
325
  )
326
326
 
327
327
  # in stand, we also randomize the agent rotation around z axis
328
- def _initialize_episode(self, env_idx: torch.Tensor, options: Dict):
328
+ def _initialize_episode(self, env_idx: torch.Tensor, options: dict):
329
329
  super()._initialize_episode(env_idx=env_idx, options=options)
330
330
  with torch.device(self.device):
331
331
  b = len(env_idx)
@@ -338,7 +338,7 @@ class HumanoidStand(HumanoidEnvStandard):
338
338
  self.agent.robot.set_root_pose(pose)
339
339
 
340
340
  def compute_normalized_dense_reward(
341
- self, obs: Any, action: torch.Tensor, info: Dict
341
+ self, obs: Any, action: torch.Tensor, info: dict
342
342
  ):
343
343
  small_control = (4 + self.control_rew(action)) / 5
344
344
  stand_rew = (
@@ -370,7 +370,7 @@ class HumanoidWalk(HumanoidEnvStandard):
370
370
  super().__init__(*args, robot_uids=robot_uids, **kwargs)
371
371
 
372
372
  def compute_normalized_dense_reward(
373
- self, obs: Any, action: torch.Tensor, info: Dict
373
+ self, obs: Any, action: torch.Tensor, info: dict
374
374
  ):
375
375
  small_control = (4 + self.control_rew(action)) / 5
376
376
  walk_rew = (
@@ -402,7 +402,7 @@ class HumanoidRun(HumanoidEnvStandard):
402
402
  super().__init__(*args, robot_uids=robot_uids, **kwargs)
403
403
 
404
404
  def compute_normalized_dense_reward(
405
- self, obs: Any, action: torch.Tensor, info: Dict
405
+ self, obs: Any, action: torch.Tensor, info: dict
406
406
  ):
407
407
  # reward function used by mjx for ppo humanoid run
408
408
  rew_scale = 0.1
@@ -421,7 +421,7 @@ class HumanoidRun(HumanoidEnvStandard):
421
421
  # def __init__(self, *args, robot_uids="humanoid", **kwargs):
422
422
  # super().__init__(*args, robot_uids=robot_uids, **kwargs)
423
423
 
424
- # def _get_obs_state_dict(self, info: Dict):
424
+ # def _get_obs_state_dict(self, info: dict):
425
425
  # # our qpos model doesn't include the free joint, meaning qpos and qvel are 21 dims, not 27
426
426
  # # global dpos/dt and root (torso) dquaterion/dt lost
427
427
  # # we replace with linear root linvel and root angularvel (equivalent info)
@@ -439,7 +439,7 @@ class HumanoidRun(HumanoidEnvStandard):
439
439
  # ].get_angular_velocity(), # free joint info, (b, 3)
440
440
  # )
441
441
 
442
- # def _initialize_episode(self, env_idx: torch.Tensor, options: Dict):
442
+ # def _initialize_episode(self, env_idx: torch.Tensor, options: dict):
443
443
  # self.camera_mount.set_pose(
444
444
  # Pose.create_from_pq(p=self.agent.robot.links_map["torso"].pose.p)
445
445
  # )
@@ -465,7 +465,7 @@ class HumanoidRun(HumanoidEnvStandard):
465
465
  # def __init__(self, *args, robot_uids="humanoid", **kwargs):
466
466
  # super().__init__(*args, robot_uids=robot_uids, **kwargs)
467
467
 
468
- # def compute_dense_reward(self, obs: Any, action: torch.Tensor, info: Dict):
468
+ # def compute_dense_reward(self, obs: Any, action: torch.Tensor, info: dict):
469
469
  # small_control = (4 + self.control_rew(action)) / 5
470
470
  # return (
471
471
  # small_control
@@ -475,7 +475,7 @@ class HumanoidRun(HumanoidEnvStandard):
475
475
  # )
476
476
 
477
477
  # def compute_normalized_dense_reward(
478
- # self, obs: Any, action: torch.Tensor, info: Dict
478
+ # self, obs: Any, action: torch.Tensor, info: dict
479
479
  # ):
480
480
  # return self.compute_dense_reward(obs, action, info)
481
481
 
@@ -487,7 +487,7 @@ class HumanoidRun(HumanoidEnvStandard):
487
487
  # def __init__(self, *args, robot_uids="humanoid", **kwargs):
488
488
  # super().__init__(*args, robot_uids=robot_uids, **kwargs)
489
489
 
490
- # def compute_dense_reward(self, obs: Any, action: torch.Tensor, info: Dict):
490
+ # def compute_dense_reward(self, obs: Any, action: torch.Tensor, info: dict):
491
491
  # small_control = (4 + self.control_rew(action)) / 5
492
492
  # return (
493
493
  # small_control
@@ -497,7 +497,7 @@ class HumanoidRun(HumanoidEnvStandard):
497
497
  # )
498
498
 
499
499
  # def compute_normalized_dense_reward(
500
- # self, obs: Any, action: torch.Tensor, info: Dict
500
+ # self, obs: Any, action: torch.Tensor, info: dict
501
501
  # ):
502
502
  # return self.compute_dense_reward(obs, action, info)
503
503
 
@@ -509,7 +509,7 @@ class HumanoidRun(HumanoidEnvStandard):
509
509
  # def __init__(self, *args, robot_uids="humanoid", **kwargs):
510
510
  # super().__init__(*args, robot_uids=robot_uids, **kwargs)
511
511
 
512
- # def compute_dense_reward(self, obs: Any, action: torch.Tensor, info: Dict):
512
+ # def compute_dense_reward(self, obs: Any, action: torch.Tensor, info: dict):
513
513
  # small_control = (4 + self.control_rew(action)) / 5
514
514
  # return (
515
515
  # small_control
@@ -519,6 +519,6 @@ class HumanoidRun(HumanoidEnvStandard):
519
519
  # )
520
520
 
521
521
  # def compute_normalized_dense_reward(
522
- # self, obs: Any, action: torch.Tensor, info: Dict
522
+ # self, obs: Any, action: torch.Tensor, info: dict
523
523
  # ):
524
524
  # return self.compute_dense_reward(obs, action, info)
@@ -1,9 +1,10 @@
1
+ import os
2
+ from typing import Any, Union
1
3
 
2
- from typing import Any, Dict, Union
3
4
  import numpy as np
4
5
  import sapien.physx as physx
5
6
  import torch
6
- import os
7
+
7
8
  from mani_skill import ASSET_DIR
8
9
  from mani_skill.agents.robots import FloatingInspireHandRight
9
10
  from mani_skill.envs.sapien_env import BaseEnv
@@ -16,9 +17,7 @@ from mani_skill.utils.structs.types import Array, GPUMemoryConfig, SimConfig
16
17
 
17
18
 
18
19
  @register_env(
19
- "InsertFlower-v1",
20
- max_episode_steps=300,
21
- asset_download_ids=["oakink-v2"]
20
+ "InsertFlower-v1", max_episode_steps=300, asset_download_ids=["oakink-v2"]
22
21
  )
23
22
  class InsertFlowerEnv(BaseEnv):
24
23
  agent: Union[FloatingInspireHandRight]
@@ -63,7 +62,9 @@ class InsertFlowerEnv(BaseEnv):
63
62
 
64
63
  @property
65
64
  def _default_sensor_configs(self):
66
- pose = sapien_utils.look_at(eye=[0.15, 0, 0.45], target=[-0.1, 0, self.hand_init_height])
65
+ pose = sapien_utils.look_at(
66
+ eye=[0.15, 0, 0.45], target=[-0.1, 0, self.hand_init_height]
67
+ )
67
68
  return [CameraConfig("base_camera", pose, 128, 128, np.pi / 2, 0.01, 100)]
68
69
 
69
70
  @property
@@ -72,12 +73,16 @@ class InsertFlowerEnv(BaseEnv):
72
73
  return CameraConfig("render_camera", pose, 512, 512, 1, 0.01, 100)
73
74
 
74
75
  def _load_scene(self, options: dict):
75
- self.table_scene = TableSceneBuilder(env=self, robot_init_qpos_noise=self.robot_init_qpos_noise)
76
+ self.table_scene = TableSceneBuilder(
77
+ env=self, robot_init_qpos_noise=self.robot_init_qpos_noise
78
+ )
76
79
  self.table_scene.build()
77
80
 
78
81
  # === Load Vase (Static) ===
79
82
  vase_builder = self.scene.create_actor_builder()
80
- vase_visual_mesh_file = os.path.join(self.asset_path, "O02@0080@00001/model.obj")
83
+ vase_visual_mesh_file = os.path.join(
84
+ self.asset_path, "O02@0080@00001/model.obj"
85
+ )
81
86
  vase_collision_mesh_file = os.path.join(
82
87
  self.asset_path, "O02@0080@00001/model.obj.coacd.ply"
83
88
  )
@@ -97,7 +102,9 @@ class InsertFlowerEnv(BaseEnv):
97
102
  )
98
103
  flower_builder.add_visual_from_file(flower_mesh_file)
99
104
 
100
- flower_material = physx.PhysxMaterial(static_friction=1, dynamic_friction=1, restitution=1)
105
+ flower_material = physx.PhysxMaterial(
106
+ static_friction=1, dynamic_friction=1, restitution=1
107
+ )
101
108
  flower_builder.add_multiple_convex_collisions_from_file(
102
109
  flower_collision_file, density=200, material=flower_material
103
110
  )
@@ -109,7 +116,9 @@ class InsertFlowerEnv(BaseEnv):
109
116
  self.flower = flower_builder.build(name="flower")
110
117
  self.target_area_box = list(self.target_area.values())
111
118
  # Convert target_area into tensor for fast computation
112
- self.target_area_box = torch.tensor(self.target_area_box, device=self.device, dtype=torch.float32).view(2, 3)
119
+ self.target_area_box = torch.tensor(
120
+ self.target_area_box, device=self.device, dtype=torch.float32
121
+ ).view(2, 3)
113
122
 
114
123
  def _after_reconfigure(self, options: dict):
115
124
  pass
@@ -125,7 +134,10 @@ class InsertFlowerEnv(BaseEnv):
125
134
  self.table_scene.initialize(env_idx)
126
135
 
127
136
  flower_pose = self.init_flower_pose
128
- flower_pose.p[:, :2] += torch.rand((b, 2)) * self.flower_spawn_half_size * 2 - self.flower_spawn_half_size
137
+ flower_pose.p[:, :2] += (
138
+ torch.rand((b, 2)) * self.flower_spawn_half_size * 2
139
+ - self.flower_spawn_half_size
140
+ )
129
141
  self.flower.set_pose(flower_pose)
130
142
 
131
143
  def _initialize_agent(self, env_idx: torch.Tensor):
@@ -139,16 +151,18 @@ class InsertFlowerEnv(BaseEnv):
139
151
  self.agent.robot.set_pose(
140
152
  Pose.create_from_pq(
141
153
  torch.tensor([0.0, 0, self.hand_init_height]),
142
- torch.tensor([
143
- 0,
144
- 0.707,
145
- 0,
146
- -0.707,
147
- ]),
154
+ torch.tensor(
155
+ [
156
+ 0,
157
+ 0.707,
158
+ 0,
159
+ -0.707,
160
+ ]
161
+ ),
148
162
  )
149
163
  )
150
164
 
151
- def _get_obs_extra(self, info: Dict):
165
+ def _get_obs_extra(self, info: dict):
152
166
  return {}
153
167
 
154
168
  def evaluate(self, **kwargs) -> dict:
@@ -162,19 +176,23 @@ class InsertFlowerEnv(BaseEnv):
162
176
 
163
177
  return {"success": is_within}
164
178
 
165
- def compute_dense_reward(self, obs: Any, action: Array, info: Dict) -> float:
179
+ def compute_dense_reward(self, obs: Any, action: Array, info: dict) -> float:
166
180
  object_pos = self.flower.pose.p
167
181
  dist_outside = torch.max(
168
- torch.max(self.target_area_box[0] - object_pos, torch.zeros_like(object_pos)), # lower bound
169
- torch.max(object_pos - self.target_area_box[1], torch.zeros_like(object_pos)), # upper bound
182
+ torch.max(
183
+ self.target_area_box[0] - object_pos, torch.zeros_like(object_pos)
184
+ ), # lower bound
185
+ torch.max(
186
+ object_pos - self.target_area_box[1], torch.zeros_like(object_pos)
187
+ ), # upper bound
170
188
  )
171
189
  reward = torch.exp(-5 * torch.norm(dist_outside)).reshape(-1)
172
190
 
173
191
  return reward
174
192
 
175
- def compute_normalized_dense_reward(self, obs: Any, action: Array, info: Dict):
193
+ def compute_normalized_dense_reward(self, obs: Any, action: Array, info: dict):
176
194
  return self.compute_dense_reward(obs=obs, action=action, info=info) / 4.0
177
195
 
178
196
 
179
197
  if __name__ == "__main__":
180
- print(InsertFlowerEnv.asset_path)
198
+ print(InsertFlowerEnv.asset_path)
@@ -1,4 +1,4 @@
1
- from typing import Any, Dict, List, Union
1
+ from typing import Any, Union
2
2
 
3
3
  import numpy as np
4
4
  import sapien
@@ -106,7 +106,7 @@ class RotateSingleObjectInHand(BaseEnv):
106
106
  obj_heights.append(0.03)
107
107
  elif self.difficulty_level == 1:
108
108
  half_sizes = (self._batched_episode_rng.randn() * 0.1 + 1) * 0.04
109
- self._objs: List[Actor] = []
109
+ self._objs: list[Actor] = []
110
110
  for i, half_size in enumerate(half_sizes):
111
111
  builder = self.scene.create_actor_builder()
112
112
  builder.add_box_collision(
@@ -131,7 +131,7 @@ class RotateSingleObjectInHand(BaseEnv):
131
131
  )
132
132
  )
133
133
  model_ids = self._batched_episode_rng.choice(all_model_ids)
134
- self._objs: List[Actor] = []
134
+ self._objs: list[Actor] = []
135
135
  for i, model_id in enumerate(model_ids):
136
136
  builder = actors.get_actor_builder(self.scene, id=f"ycb:{model_id}")
137
137
  builder.set_scene_idxs([i])
@@ -216,7 +216,7 @@ class RotateSingleObjectInHand(BaseEnv):
216
216
  )
217
217
  )
218
218
 
219
- def _get_obs_extra(self, info: Dict):
219
+ def _get_obs_extra(self, info: dict):
220
220
  with torch.device(self.device):
221
221
  obs = dict(rotate_dir=self.rot_dir)
222
222
  if self.obs_mode_struct.use_state:
@@ -283,7 +283,7 @@ class RotateSingleObjectInHand(BaseEnv):
283
283
  fail=obj_fall,
284
284
  )
285
285
 
286
- def compute_dense_reward(self, obs: Any, action: Array, info: Dict):
286
+ def compute_dense_reward(self, obs: Any, action: Array, info: dict):
287
287
  # 1. rotation reward
288
288
  angle = info["rotation_angle"]
289
289
  reward = 20 * angle
@@ -312,7 +312,7 @@ class RotateSingleObjectInHand(BaseEnv):
312
312
 
313
313
  return reward
314
314
 
315
- def compute_normalized_dense_reward(self, obs: Any, action: Array, info: Dict):
315
+ def compute_normalized_dense_reward(self, obs: Any, action: Array, info: dict):
316
316
  # this should be equal to compute_dense_reward / max possible reward
317
317
  return self.compute_dense_reward(obs=obs, action=action, info=info) / 4.0
318
318
 
@@ -1,4 +1,4 @@
1
- from typing import Any, Dict, List, Union
1
+ from typing import Any, Union
2
2
 
3
3
  import numpy as np
4
4
  import torch
@@ -107,7 +107,7 @@ class RotateValveEnv(BaseEnv):
107
107
  f"Difficulty level must be a int within 0-4, but get {self.difficulty_level}"
108
108
  )
109
109
 
110
- valves: List[Articulation] = []
110
+ valves: list[Articulation] = []
111
111
  capsule_lens = []
112
112
  valve_links = []
113
113
  for i, valve_angles in enumerate(valve_angles_list):
@@ -183,7 +183,7 @@ class RotateValveEnv(BaseEnv):
183
183
  )
184
184
  )
185
185
 
186
- def _get_obs_extra(self, info: Dict):
186
+ def _get_obs_extra(self, info: dict):
187
187
  with torch.device(self.device):
188
188
  valve_qpos = self.valve.qpos
189
189
  valve_qvel = self.valve.qvel
@@ -205,7 +205,7 @@ class RotateValveEnv(BaseEnv):
205
205
  success = valve_rotation * self.rotate_direction > self.success_threshold
206
206
  return dict(success=success, valve_rotation=valve_rotation)
207
207
 
208
- def compute_dense_reward(self, obs: Any, action: Array, info: Dict):
208
+ def compute_dense_reward(self, obs: Any, action: Array, info: dict):
209
209
  rotation = info["valve_rotation"]
210
210
  qvel = self.valve.qvel
211
211
 
@@ -226,7 +226,7 @@ class RotateValveEnv(BaseEnv):
226
226
 
227
227
  return reward
228
228
 
229
- def compute_normalized_dense_reward(self, obs: Any, action: Array, info: Dict):
229
+ def compute_normalized_dense_reward(self, obs: Any, action: Array, info: dict):
230
230
  # this should be equal to compute_dense_reward / max possible reward
231
231
  return self.compute_dense_reward(obs=obs, action=action, info=info) / 6.0
232
232
 
@@ -1,5 +1,5 @@
1
1
  import os
2
- from typing import Dict, List, Union
2
+ from typing import Union
3
3
 
4
4
  import cv2
5
5
  import torch
@@ -39,15 +39,15 @@ class BaseDigitalTwinEnv(BaseEnv):
39
39
  Use `self.remove_object_from_greenscreen(object: Actor | Link | Articulation)` to exclude those objects from the greenscreen process.
40
40
  """
41
41
 
42
- rgb_overlay_paths: Dict[str, str] = None
42
+ rgb_overlay_paths: dict[str, str] = None
43
43
  """dict mapping camera name to the file path of the greenscreening image"""
44
- _rgb_overlay_images: Dict[str, torch.Tensor] = dict()
44
+ _rgb_overlay_images: dict[str, torch.Tensor] = dict()
45
45
  """dict mapping camera name to the image torch tensor"""
46
46
  rgb_overlay_mode: str = "background"
47
47
  """which RGB overlay mode to use during the greenscreen process. The default is 'background' which enables greenscreening like normal. The other option is 'debug' mode which
48
48
  will make the opacity of the original render and greenscreen overlay both 50%. The third option is "none" which will not perform any greenscreening."""
49
49
 
50
- _objects_to_remove_from_greenscreen: List[Union[Actor, Link]] = []
50
+ _objects_to_remove_from_greenscreen: list[Union[Actor, Link]] = []
51
51
  """list of articulations/actors/links that should be removed from the greenscreen process"""
52
52
  _segmentation_ids_to_keep: torch.Tensor = None
53
53
  """torch tensor of segmentation ids that reference the objects that should not be greenscreened"""
@@ -2,7 +2,7 @@
2
2
  Base environment for Bridge dataset environments
3
3
  """
4
4
  import os
5
- from typing import Dict, List, Literal
5
+ from typing import Literal
6
6
 
7
7
  import numpy as np
8
8
  import sapien
@@ -158,7 +158,7 @@ class BaseBridgeEnv(BaseDigitalTwinEnv):
158
158
  SUPPORTED_OBS_MODES = ["rgb+segmentation"]
159
159
  SUPPORTED_REWARD_MODES = ["none"]
160
160
  scene_setting: Literal["flat_table", "sink"] = "flat_table"
161
- objects_excluded_from_greenscreening: List[str] = []
161
+ objects_excluded_from_greenscreening: list[str] = []
162
162
  """object ids that should not be greenscreened"""
163
163
 
164
164
  obj_static_friction = 0.5
@@ -166,12 +166,12 @@ class BaseBridgeEnv(BaseDigitalTwinEnv):
166
166
 
167
167
  def __init__(
168
168
  self,
169
- obj_names: List[str],
169
+ obj_names: list[str],
170
170
  xyz_configs: torch.Tensor,
171
171
  quat_configs: torch.Tensor,
172
172
  **kwargs,
173
173
  ):
174
- self.objs: Dict[str, Actor] = dict()
174
+ self.objs: dict[str, Actor] = dict()
175
175
  self.obj_names = obj_names
176
176
  self.source_obj_name = obj_names[0]
177
177
  self.target_obj_name = obj_names[1]
@@ -192,13 +192,13 @@ class BaseBridgeEnv(BaseDigitalTwinEnv):
192
192
  }
193
193
  robot_cls = WidowX250SBridgeDatasetSink
194
194
 
195
- self.model_db: Dict[str, Dict] = io_utils.load_json(
195
+ self.model_db: dict[str, dict] = io_utils.load_json(
196
196
  BRIDGE_DATASET_ASSET_PATH / "custom/" / self.MODEL_JSON
197
197
  )
198
-
198
+
199
199
  self.consecutive_grasp = None
200
200
  self.episode_stats = None
201
-
201
+
202
202
  super().__init__(
203
203
  robot_uids=robot_cls,
204
204
  **kwargs,
@@ -459,13 +459,23 @@ class BaseBridgeEnv(BaseDigitalTwinEnv):
459
459
  """target object bbox size (3, )"""
460
460
 
461
461
  if self.consecutive_grasp is None:
462
- self.consecutive_grasp = torch.zeros(self.num_envs, dtype=torch.int32).to(self.device)
462
+ self.consecutive_grasp = torch.zeros(
463
+ self.num_envs, dtype=torch.int32
464
+ ).to(self.device)
463
465
  if self.episode_stats is None:
464
466
  self.episode_stats = dict(
465
- moved_correct_obj=torch.zeros((self.num_envs,), dtype=torch.bool).to(self.device),
466
- moved_wrong_obj=torch.zeros((self.num_envs,), dtype=torch.bool).to(self.device),
467
- is_src_obj_grasped=torch.zeros((self.num_envs,), dtype=torch.bool).to(self.device),
468
- consecutive_grasp=torch.zeros((self.num_envs,), dtype=torch.bool).to(self.device),
467
+ moved_correct_obj=torch.zeros(
468
+ (self.num_envs,), dtype=torch.bool
469
+ ).to(self.device),
470
+ moved_wrong_obj=torch.zeros((self.num_envs,), dtype=torch.bool).to(
471
+ self.device
472
+ ),
473
+ is_src_obj_grasped=torch.zeros(
474
+ (self.num_envs,), dtype=torch.bool
475
+ ).to(self.device),
476
+ consecutive_grasp=torch.zeros(
477
+ (self.num_envs,), dtype=torch.bool
478
+ ).to(self.device),
469
479
  )
470
480
  # stats to track
471
481
  self.consecutive_grasp[env_idx] = 0
@@ -1,5 +1,5 @@
1
1
  from dataclasses import asdict, dataclass
2
- from typing import Any, Dict, Optional, Sequence, Union
2
+ from typing import Any, Optional, Sequence, Union
3
3
 
4
4
  import dacite
5
5
  import numpy as np
@@ -394,7 +394,7 @@ class SO100GraspCubeEnv(BaseDigitalTwinEnv):
394
394
  obs.update(controller=controller_state)
395
395
  return obs
396
396
 
397
- def _get_obs_extra(self, info: Dict):
397
+ def _get_obs_extra(self, info: dict):
398
398
  # we ensure that the observation data is always retrievable in the real world, using only real world
399
399
  # available data (joint positions or the controllers target joint positions in this case).
400
400
  obs = dict(
@@ -453,7 +453,7 @@ class SO100GraspCubeEnv(BaseDigitalTwinEnv):
453
453
  "success": success,
454
454
  }
455
455
 
456
- def compute_dense_reward(self, obs: Any, action: torch.Tensor, info: Dict):
456
+ def compute_dense_reward(self, obs: Any, action: torch.Tensor, info: dict):
457
457
  # note the info object is the data returned by the evaluate function. We can reuse information
458
458
  # to save compute time.
459
459
  # this reward function essentially has two stages, before and after grasping.
@@ -473,7 +473,7 @@ class SO100GraspCubeEnv(BaseDigitalTwinEnv):
473
473
  return reward
474
474
 
475
475
  def compute_normalized_dense_reward(
476
- self, obs: Any, action: torch.Tensor, info: Dict
476
+ self, obs: Any, action: torch.Tensor, info: dict
477
477
  ):
478
478
  # for more stable RL we often also permit defining a noramlized reward function where you manually scale the reward down by its max value like so
479
479
  return self.compute_dense_reward(obs=obs, action=action, info=info) / 3
@@ -1,5 +1,3 @@
1
- from typing import Dict
2
-
3
1
  import numpy as np
4
2
  import sapien
5
3
  import torch
@@ -196,7 +194,7 @@ class TableTopFreeDrawEnv(BaseEnv):
196
194
  def evaluate(self):
197
195
  return {}
198
196
 
199
- def _get_obs_extra(self, info: Dict):
197
+ def _get_obs_extra(self, info: dict):
200
198
  return dict(
201
199
  tcp_pose=self.agent.tcp.pose.raw_pose,
202
200
  )
@@ -1,9 +1,9 @@
1
- from typing import Dict
2
-
3
- import mani_skill.envs.utils.randomization as randomization
4
1
  import numpy as np
5
2
  import sapien
6
3
  import torch
4
+ from transforms3d.euler import euler2quat
5
+
6
+ import mani_skill.envs.utils.randomization as randomization
7
7
  from mani_skill.agents.robots.panda.panda_stick import PandaStick
8
8
  from mani_skill.envs.sapien_env import BaseEnv
9
9
  from mani_skill.sensors.camera import CameraConfig
@@ -14,7 +14,6 @@ from mani_skill.utils.scene_builder.table.scene_builder import TableSceneBuilder
14
14
  from mani_skill.utils.structs.actor import Actor
15
15
  from mani_skill.utils.structs.pose import Pose
16
16
  from mani_skill.utils.structs.types import SceneConfig, SimConfig
17
- from transforms3d.euler import euler2quat
18
17
 
19
18
 
20
19
  @register_env("DrawSVG-v1", max_episode_steps=500)
@@ -22,18 +21,17 @@ class DrawSVGEnv(BaseEnv):
22
21
  r"""
23
22
  **Task Description:**
24
23
  Instantiates a table with a white canvas on it and a svg path specified with an outline. A robot with a stick is to draw the triangle with a red line.
25
-
24
+
26
25
  **Randomizations:**
27
26
  - the goal svg's position on the xy-plane is randomized
28
27
  - the goal svg's z-rotation is randomized in range [0, 2 $\pi$]
29
-
28
+
30
29
  **Success Conditions:**
31
30
  - the drawn points by the robot are within a euclidean distance of 0.05m with points on the goal svg
32
31
  """
33
32
 
34
33
  _sample_video_link = "https://github.com/haosulab/ManiSkill/raw/main/figures/environment_demos/DrawSVG-v1_rt.mp4"
35
34
 
36
-
37
35
  MAX_DOTS = 1000
38
36
  """
39
37
  The total "ink" available to use and draw with before you need to call env.reset. NOTE that on GPU simulation it is not recommended to have a very high value for this as it can slow down rendering
@@ -340,7 +338,7 @@ class DrawSVGEnv(BaseEnv):
340
338
  out = self.success_check()
341
339
  return {"success": out}
342
340
 
343
- def _get_obs_extra(self, info: Dict):
341
+ def _get_obs_extra(self, info: dict):
344
342
  obs = dict(
345
343
  tcp_pose=self.agent.tcp.pose.raw_pose,
346
344
  )
@@ -1,5 +1,4 @@
1
1
  import math
2
- from typing import Dict
3
2
 
4
3
  import numpy as np
5
4
  import sapien
@@ -309,7 +308,7 @@ class DrawTriangleEnv(BaseEnv):
309
308
  out = self.success_check()
310
309
  return {"success": out}
311
310
 
312
- def _get_obs_extra(self, info: Dict):
311
+ def _get_obs_extra(self, info: dict):
313
312
  obs = dict(
314
313
  tcp_pose=self.agent.tcp.pose.raw_pose,
315
314
  )
@@ -1,5 +1,3 @@
1
- from typing import Dict
2
-
3
1
  import numpy as np
4
2
  import sapien
5
3
  import torch
@@ -47,5 +45,5 @@ class EmptyEnv(BaseEnv):
47
45
  def evaluate(self):
48
46
  return {}
49
47
 
50
- def _get_obs_extra(self, info: Dict):
48
+ def _get_obs_extra(self, info: dict):
51
49
  return dict()
@@ -1,5 +1,4 @@
1
1
  import os.path as osp
2
- from typing import Dict
3
2
 
4
3
  import numpy as np
5
4
  import sapien
@@ -178,7 +177,7 @@ class FMBAssembly1Env(BaseEnv):
178
177
  )
179
178
  return {"success": bridge_placed}
180
179
 
181
- def _get_obs_extra(self, info: Dict):
180
+ def _get_obs_extra(self, info: dict):
182
181
  obs = dict(tcp_pose=self.agent.tcp.pose.raw_pose)
183
182
  if self.obs_mode_struct.use_state:
184
183
  obs.update(