mani-skill-nightly 2025.10.21.2011__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 (124) 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 +36 -33
  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/trajectory/replay_trajectory.py +0 -1
  78. mani_skill/utils/assets/data.py +3 -3
  79. mani_skill/utils/building/_mjcf_loader.py +11 -11
  80. mani_skill/utils/building/actor_builder.py +4 -4
  81. mani_skill/utils/building/articulation_builder.py +3 -3
  82. mani_skill/utils/building/mjcf_loader.py +6 -6
  83. mani_skill/utils/building/urdf_loader.py +6 -6
  84. mani_skill/utils/common.py +2 -2
  85. mani_skill/utils/geometry/bounding_cylinder.py +4 -4
  86. mani_skill/utils/geometry/geometry.py +1 -3
  87. mani_skill/utils/geometry/trimesh_utils.py +1 -3
  88. mani_skill/utils/gym_utils.py +2 -4
  89. mani_skill/utils/registration.py +6 -6
  90. mani_skill/utils/sapien_utils.py +21 -21
  91. mani_skill/utils/scene_builder/ai2thor/constants.py +1 -2
  92. mani_skill/utils/scene_builder/ai2thor/scene_builder.py +9 -9
  93. mani_skill/utils/scene_builder/control/planar/scene_builder.py +2 -4
  94. mani_skill/utils/scene_builder/kitchen_counter/scene_builder.py +1 -2
  95. mani_skill/utils/scene_builder/registration.py +1 -2
  96. mani_skill/utils/scene_builder/replicacad/rearrange/scene_builder.py +16 -16
  97. mani_skill/utils/scene_builder/replicacad/scene_builder.py +15 -15
  98. mani_skill/utils/scene_builder/robocasa/fixtures/windows.py +2 -4
  99. mani_skill/utils/scene_builder/robocasa/scene_builder.py +5 -5
  100. mani_skill/utils/scene_builder/scene_builder.py +15 -15
  101. mani_skill/utils/scene_builder/table/scene_builder.py +1 -2
  102. mani_skill/utils/structs/actor.py +6 -6
  103. mani_skill/utils/structs/articulation.py +32 -30
  104. mani_skill/utils/structs/articulation_joint.py +6 -6
  105. mani_skill/utils/structs/base.py +14 -9
  106. mani_skill/utils/structs/drive.py +2 -2
  107. mani_skill/utils/structs/link.py +10 -8
  108. mani_skill/utils/structs/pose.py +3 -3
  109. mani_skill/utils/structs/render_camera.py +4 -4
  110. mani_skill/utils/structs/types.py +3 -1
  111. mani_skill/utils/visualization/jupyter_utils.py +1 -3
  112. mani_skill/utils/visualization/misc.py +5 -5
  113. mani_skill/utils/wrappers/cached_reset.py +5 -3
  114. mani_skill/utils/wrappers/flatten.py +1 -2
  115. mani_skill/utils/wrappers/record.py +10 -8
  116. mani_skill/utils/wrappers/visual_encoders.py +2 -2
  117. mani_skill/vector/wrappers/gymnasium.py +23 -13
  118. mani_skill/vector/wrappers/sb3.py +5 -5
  119. {mani_skill_nightly-2025.10.21.2011.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/METADATA +1 -1
  120. {mani_skill_nightly-2025.10.21.2011.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/RECORD +124 -124
  121. {mani_skill_nightly-2025.10.21.2011.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/WHEEL +0 -0
  122. {mani_skill_nightly-2025.10.21.2011.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/licenses/LICENSE +0 -0
  123. {mani_skill_nightly-2025.10.21.2011.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/licenses/LICENSE-3RD-PARTY +0 -0
  124. {mani_skill_nightly-2025.10.21.2011.dist-info → mani_skill_nightly-2025.10.22.157.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,4 @@
1
1
  from dataclasses import dataclass
2
- from typing import Dict
3
2
 
4
3
  from mani_skill import logger
5
4
  from mani_skill.agents.base_agent import BaseAgent
@@ -13,7 +12,7 @@ class SceneBuilderSpec:
13
12
  scene_builder_cls: type[scene_builder.SceneBuilder]
14
13
 
15
14
 
16
- REGISTERED_SCENE_BUILDERS: Dict[str, SceneBuilderSpec] = {}
15
+ REGISTERED_SCENE_BUILDERS: dict[str, SceneBuilderSpec] = {}
17
16
 
18
17
 
19
18
  def register_scene_builder(uid: str, override=False):
@@ -6,7 +6,7 @@ import os.path as osp
6
6
  from collections import defaultdict
7
7
  from functools import cached_property
8
8
  from pathlib import Path
9
- from typing import Dict, List, Optional, Tuple
9
+ from typing import Optional, Tuple
10
10
 
11
11
  import numpy as np
12
12
  import sapien
@@ -25,10 +25,10 @@ DEFAULT_HIDDEN_POS = [-10_000] * 3
25
25
 
26
26
  class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
27
27
 
28
- task_names: List[str] = ["set_table:train"]
28
+ task_names: list[str] = ["set_table:train"]
29
29
 
30
30
  # init configs for Rearrange stasks are default_object_poses for each object type
31
- init_configs: List[List[Dict[str, List[sapien.Pose]]]] = None
31
+ init_configs: list[list[dict[str, list[sapien.Pose]]]] = None
32
32
 
33
33
  def __init__(self, env):
34
34
  # the Habitat Rearrange tasks build on the base ReplicaCAD scenes by creating episode configs
@@ -87,7 +87,7 @@ class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
87
87
  )
88
88
 
89
89
  def build(
90
- self, build_config_idxs: List[int], init_config_names: Optional[list] = None
90
+ self, build_config_idxs: list[int], init_config_names: Optional[list] = None
91
91
  ):
92
92
  if isinstance(build_config_idxs, int):
93
93
  build_config_idxs = [build_config_idxs] * self.env.num_envs
@@ -120,12 +120,12 @@ class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
120
120
 
121
121
  # self.rcad_to_rearrange_configs: which rearrange episode configs use each rcad config
122
122
  # default_object_poses: default poses for ycb objects from each rearrange episode config
123
- self.rcad_to_rearrange_configs: Dict[str, List[str]] = dict()
124
- default_object_poses: Dict[str, Dict[str, List[sapien.Pose]]] = dict()
123
+ self.rcad_to_rearrange_configs: dict[str, list[str]] = dict()
124
+ default_object_poses: dict[str, dict[str, list[sapien.Pose]]] = dict()
125
125
  if init_config_names is None:
126
126
  init_config_names = self._rearrange_configs
127
127
  for rc in init_config_names:
128
- objects: Dict[str, List[sapien.Pose]] = defaultdict(list)
128
+ objects: dict[str, list[sapien.Pose]] = defaultdict(list)
129
129
 
130
130
  with open(
131
131
  osp.join(
@@ -150,7 +150,7 @@ class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
150
150
  default_object_poses[rc] = objects
151
151
 
152
152
  # create init config
153
- self.init_configs: List[List[Dict[str, List[sapien.Pose]]]] = [
153
+ self.init_configs: list[list[dict[str, list[sapien.Pose]]]] = [
154
154
  [
155
155
  default_object_poses[rc]
156
156
  for rc in self.rcad_to_rearrange_configs[self.build_configs[bci]]
@@ -163,7 +163,7 @@ class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
163
163
  # build multiple instances of each YCB object for each RCAD scene
164
164
  # when initializing, we set poses according to the sampled init configs,
165
165
  # and we hide any unused instances of YCB objects
166
- rcad_config_to_num_ycb_objs_to_build: Dict[str, Dict[str, int]] = dict()
166
+ rcad_config_to_num_ycb_objs_to_build: dict[str, dict[str, int]] = dict()
167
167
  for rcad_config in self.rcad_to_rearrange_configs.keys():
168
168
  obj_ids = set()
169
169
  for rearrange_config in self.rcad_to_rearrange_configs[rcad_config]:
@@ -195,7 +195,7 @@ class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
195
195
  (env_num, copy.deepcopy(DEFAULT_HIDDEN_POS))
196
196
  for env_num in range(len(build_config_idxs))
197
197
  )
198
- self._default_hidden_poses: Dict[Actor, sapien.Pose] = dict()
198
+ self._default_hidden_poses: dict[Actor, sapien.Pose] = dict()
199
199
  for env_num, bci in enumerate(build_config_idxs):
200
200
  rcad_config = self.build_configs[bci]
201
201
  num_ycb_objs_to_build = rcad_config_to_num_ycb_objs_to_build[rcad_config]
@@ -220,12 +220,12 @@ class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
220
220
  self.movable_objects[obj_instance_name] = actor
221
221
  self.ycb_objs_per_env.append(ycb_objs)
222
222
 
223
- self.rcad_config_to_rearrange_ao_states: Dict[
224
- str, List[List[Tuple[Articulation, torch.Tensor]]]
223
+ self.rcad_config_to_rearrange_ao_states: dict[
224
+ str, list[list[Tuple[Articulation, torch.Tensor]]]
225
225
  ] = defaultdict(list)
226
226
  for env_num, bci in enumerate(build_config_idxs):
227
227
  rcad_config = self.build_configs[bci]
228
- rearrange_ao_states: List[List[Tuple[Articulation, torch.Tensor]]] = []
228
+ rearrange_ao_states: list[list[Tuple[Articulation, torch.Tensor]]] = []
229
229
  for rearrange_config in self.rcad_to_rearrange_configs[rcad_config]:
230
230
  with open(
231
231
  osp.join(
@@ -236,8 +236,8 @@ class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
236
236
  "rb",
237
237
  ) as f:
238
238
  episode_json = json.load(f)
239
- episode_ao_states: Dict[str, Dict[str, int]] = episode_json["ao_states"]
240
- articulation_qpos_pairs: List[Tuple[Articulation, torch.Tensor]] = []
239
+ episode_ao_states: dict[str, dict[str, int]] = episode_json["ao_states"]
240
+ articulation_qpos_pairs: list[Tuple[Articulation, torch.Tensor]] = []
241
241
  for base_articulation_id, qpos_dict in episode_ao_states.items():
242
242
  aid, anum = base_articulation_id.split(":")
243
243
  articulation = self.articulations[
@@ -256,7 +256,7 @@ class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
256
256
  self.rcad_config_to_rearrange_ao_states[rcad_config] = rearrange_ao_states
257
257
 
258
258
  # TODO (arth): fix this to work with partial resets
259
- def initialize(self, env_idx: torch.Tensor, init_config_idxs: List[int]):
259
+ def initialize(self, env_idx: torch.Tensor, init_config_idxs: list[int]):
260
260
  assert all(
261
261
  [isinstance(ici, int) for ici in init_config_idxs]
262
262
  ), f"init_config_idxs should be list of ints, instead got {init_config_idxs}"
@@ -9,7 +9,7 @@ import os.path as osp
9
9
  from collections import defaultdict
10
10
  from functools import cached_property
11
11
  from pathlib import Path
12
- from typing import Dict, List, Tuple, Union
12
+ from typing import Tuple, Union
13
13
 
14
14
  import numpy as np
15
15
  import sapien
@@ -42,7 +42,7 @@ class ReplicaCADSceneBuilder(SceneBuilder):
42
42
  builds_lighting = True # we set this true because the ReplicaCAD dataset defines some lighting for us so we don't need the default option from ManiSkill
43
43
 
44
44
  # build configs for RCAD are string file names
45
- build_configs: List[str] = None
45
+ build_configs: list[str] = None
46
46
 
47
47
  def __init__(self, env, robot_init_qpos_noise=0.02, include_staging_scenes=False):
48
48
  super().__init__(env, robot_init_qpos_noise=robot_init_qpos_noise)
@@ -60,9 +60,9 @@ class ReplicaCADSceneBuilder(SceneBuilder):
60
60
  # cache navigable positions from files
61
61
  # assumes navigable position files saved
62
62
  self._navigable_positions = [None] * len(self.build_configs)
63
- self.build_config_idxs: List[int] = None
63
+ self.build_config_idxs: list[int] = None
64
64
 
65
- def build(self, build_config_idxs: Union[int, List[int]]):
65
+ def build(self, build_config_idxs: Union[int, list[int]]):
66
66
  # build_config_idxs is a list of integers, where the ith value is the scene idx for the ith parallel env
67
67
  if isinstance(build_config_idxs, int):
68
68
  build_config_idxs = [build_config_idxs] * self.env.num_envs
@@ -74,10 +74,10 @@ class ReplicaCADSceneBuilder(SceneBuilder):
74
74
 
75
75
  # Keep track of movable and static objects, build_config_idxs for envs, and poses
76
76
  self.build_config_idxs = build_config_idxs
77
- self.scene_objects: Dict[str, Actor] = dict()
78
- self.movable_objects: Dict[str, Actor] = dict()
79
- self.articulations: Dict[str, Articulation] = dict()
80
- self._default_object_poses: List[Tuple[Actor, sapien.Pose]] = []
77
+ self.scene_objects: dict[str, Actor] = dict()
78
+ self.movable_objects: dict[str, Actor] = dict()
79
+ self.articulations: dict[str, Articulation] = dict()
80
+ self._default_object_poses: list[Tuple[Actor, sapien.Pose]] = []
81
81
 
82
82
  # keep track of background objects separately as we need to disable mobile robot collisions
83
83
  # note that we will create a merged actor using these objects to represent the bg
@@ -235,12 +235,12 @@ class ReplicaCADSceneBuilder(SceneBuilder):
235
235
 
236
236
  # for now classify articulated objects as "movable" object
237
237
  for env_num in env_idx:
238
- self.articulations[f"env-{env_num}_{articulation_name}"] = (
239
- articulation
240
- )
241
- self.scene_objects[f"env-{env_num}_{articulation_name}"] = (
242
- articulation
243
- )
238
+ self.articulations[
239
+ f"env-{env_num}_{articulation_name}"
240
+ ] = articulation
241
+ self.scene_objects[
242
+ f"env-{env_num}_{articulation_name}"
243
+ ] = articulation
244
244
 
245
245
  for link in articulation.links:
246
246
  link.set_collision_group_bit(
@@ -335,7 +335,7 @@ class ReplicaCADSceneBuilder(SceneBuilder):
335
335
  )
336
336
 
337
337
  @property
338
- def navigable_positions(self) -> List[trimesh.Trimesh]:
338
+ def navigable_positions(self) -> list[trimesh.Trimesh]:
339
339
  return [self._navigable_positions[bci] for bci in self.build_config_idxs]
340
340
 
341
341
  @cached_property
@@ -1,5 +1,3 @@
1
- from typing import List
2
-
3
1
  import numpy as np
4
2
  import sapien
5
3
  import sapien.physx as physx
@@ -53,7 +51,7 @@ class Window:
53
51
  ):
54
52
  self.scene = scene
55
53
  self.name = name
56
- self.objects: List[ActorBuilder] = []
54
+ self.objects: list[ActorBuilder] = []
57
55
  self.euler = [0, 0, 0]
58
56
 
59
57
  self.size = size
@@ -137,7 +135,7 @@ class Window:
137
135
  self.rng = np.random.default_rng()
138
136
  # change to create objects then create positions
139
137
 
140
- def build(self, scene_idxs: List[int]):
138
+ def build(self, scene_idxs: list[int]):
141
139
  self.actor_builder.set_scene_idxs(scene_idxs)
142
140
  self.actor_builder.initial_pose = sapien.Pose(
143
141
  p=np.array(self.pos), q=euler2quat(*self.euler)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import logging
4
4
  from copy import deepcopy
5
- from typing import Dict, List, Optional
5
+ from typing import Optional
6
6
 
7
7
  import numpy as np
8
8
  import torch
@@ -154,7 +154,7 @@ class RoboCasaSceneBuilder(SceneBuilder):
154
154
  self.scene_data = [] # maps scene_idx to {"fixtures", "fxtr_placements"}
155
155
  super().__init__(*args, **kwargs)
156
156
 
157
- def build(self, build_config_idxs: Optional[List[int]] = None):
157
+ def build(self, build_config_idxs: Optional[list[int]] = None):
158
158
  if self.env.agent is not None:
159
159
  self.robot_poses = self.env.agent.robot.initial_pose
160
160
  else:
@@ -231,7 +231,7 @@ class RoboCasaSceneBuilder(SceneBuilder):
231
231
  arena.extend(group_fixtures)
232
232
 
233
233
  # maps each fixture name to its object class
234
- fixtures: Dict[str, Fixture] = dict()
234
+ fixtures: dict[str, Fixture] = dict()
235
235
  # maps each fixture name to its configuration
236
236
  configs = dict()
237
237
  # names of composites, delete from fixtures before returning
@@ -398,7 +398,7 @@ class RoboCasaSceneBuilder(SceneBuilder):
398
398
  euler2quat(*robot_base_ori)
399
399
  ).to(self.robot_poses.device)
400
400
 
401
- actors: Dict[str, Actor] = {}
401
+ actors: dict[str, Actor] = {}
402
402
 
403
403
  ### collision handling and optimization ###
404
404
  # Generally we aim to ensure all articulations in a stack have the same collision bits so they can't collide with each other
@@ -560,7 +560,7 @@ class RoboCasaSceneBuilder(SceneBuilder):
560
560
  robot_base_ori = None
561
561
  return fxtr_placements, robot_base_pos, robot_base_ori
562
562
 
563
- def initialize(self, env_idx: torch.Tensor, init_config_idxs: List[int] = None):
563
+ def initialize(self, env_idx: torch.Tensor, init_config_idxs: list[int] = None):
564
564
  with torch.device(self.env.device):
565
565
  if self.env.agent is not None:
566
566
  if self.env.robot_uids == "fetch":
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from functools import cached_property
4
- from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
4
+ from typing import TYPE_CHECKING, Any, Optional, Union
5
5
 
6
6
  import sapien
7
7
  import torch
@@ -30,38 +30,38 @@ class SceneBuilder:
30
30
  builds_lighting: bool = False
31
31
  """Whether this scene builder will add its own lighting when build is called. If False, ManiSkill will add some default lighting"""
32
32
 
33
- build_configs: Optional[List[Any]] = None
34
- """List of scene configuration information that can be used to **build** scenes during reconfiguration (i.e. `env.reset(seed=seed, options=dict(reconfigure=True))`). Can be a dictionary, a path to a json file, or some other data. If a scene needs to load build config data, it will index/sample such build configs from this list."""
35
- init_configs: Optional[List[Any]] = None
36
- """List of scene configuration information that can be used to **init** scenes during reconfiguration (i.e. `env.reset()`). Can be a dictionary, a path to a json file, or some other data. If a scene needs to load init config data, it will index/sample such init configs from this list."""
33
+ build_configs: Optional[list[Any]] = None
34
+ """list of scene configuration information that can be used to **build** scenes during reconfiguration (i.e. `env.reset(seed=seed, options=dict(reconfigure=True))`). Can be a dictionary, a path to a json file, or some other data. If a scene needs to load build config data, it will index/sample such build configs from this list."""
35
+ init_configs: Optional[list[Any]] = None
36
+ """list of scene configuration information that can be used to **init** scenes during reconfiguration (i.e. `env.reset()`). Can be a dictionary, a path to a json file, or some other data. If a scene needs to load init config data, it will index/sample such init configs from this list."""
37
37
 
38
- scene_objects: Optional[Dict[str, Actor]] = None
38
+ scene_objects: Optional[dict[str, Actor]] = None
39
39
  """Scene objects are any dynamic, kinematic, or static Actor built by the scene builder. Useful for accessing objects in the scene directly."""
40
- movable_objects: Optional[Dict[str, Actor]] = None
40
+ movable_objects: Optional[dict[str, Actor]] = None
41
41
  """Movable objects are any **dynamic** Actor built by the scene builder. movable_objects is a subset of scene_objects. Can be used to query dynamic objects for e.g. task initialization."""
42
- articulations: Optional[Dict[str, Articulation]] = None
42
+ articulations: Optional[dict[str, Articulation]] = None
43
43
  """Articulations are any articulation loaded in by the scene builder."""
44
44
 
45
- navigable_positions: Optional[List[Union[Array, spaces.Box]]] = None
45
+ navigable_positions: Optional[list[Union[Array, spaces.Box]]] = None
46
46
  """Some scenes allow for mobile robots to move through these scene. In this case, a list of navigable positions per env_idx (e.g. loaded from a navmesh) should be provided for easy initialization. Can be a discretized list, range, spaces.Box, etc."""
47
47
 
48
48
  def __init__(self, env, robot_init_qpos_noise=0.02):
49
49
  self.env = env
50
50
  self.robot_init_qpos_noise = robot_init_qpos_noise
51
51
 
52
- def build(self, build_config_idxs: List[int] = None):
52
+ def build(self, build_config_idxs: list[int] = None):
53
53
  """
54
54
  Should create actor/articulation builders and only build objects into the scene without initializing pose, qpos, velocities etc.
55
55
  """
56
56
  raise NotImplementedError()
57
57
 
58
- def initialize(self, env_idx: torch.Tensor, init_config_idxs: List[int] = None):
58
+ def initialize(self, env_idx: torch.Tensor, init_config_idxs: list[int] = None):
59
59
  """
60
60
  Should initialize the scene, which can include e.g. setting the pose of all objects, changing the qpos/pose of articulations/robots etc.
61
61
  """
62
62
  raise NotImplementedError()
63
63
 
64
- def sample_build_config_idxs(self) -> List[int]:
64
+ def sample_build_config_idxs(self) -> list[int]:
65
65
  """
66
66
  Sample idxs of build configs for easy scene randomization. Should be changed to fit shape of self.build_configs.
67
67
  """
@@ -69,7 +69,7 @@ class SceneBuilder:
69
69
  low=0, high=len(self.build_configs), size=(self.env.num_envs,)
70
70
  ).tolist()
71
71
 
72
- def sample_init_config_idxs(self) -> List[int]:
72
+ def sample_init_config_idxs(self) -> list[int]:
73
73
  """
74
74
  Sample idxs of init configs for easy scene randomization. Should be changed to fit shape of self.init_configs.
75
75
  """
@@ -78,11 +78,11 @@ class SceneBuilder:
78
78
  ).tolist()
79
79
 
80
80
  @cached_property
81
- def build_config_names_to_idxs(self) -> Dict[str, int]:
81
+ def build_config_names_to_idxs(self) -> dict[str, int]:
82
82
  return dict((v, i) for i, v in enumerate(self.build_configs))
83
83
 
84
84
  @cached_property
85
- def init_config_names_to_idxs(self) -> Dict[str, int]:
85
+ def init_config_names_to_idxs(self) -> dict[str, int]:
86
86
  return dict((v, i) for i, v in enumerate(self.init_configs))
87
87
 
88
88
  @property
@@ -1,6 +1,5 @@
1
1
  import os.path as osp
2
2
  from pathlib import Path
3
- from typing import List
4
3
 
5
4
  import numpy as np
6
5
  import sapien
@@ -63,7 +62,7 @@ class TableSceneBuilder(SceneBuilder):
63
62
  self.scene, floor_width=floor_width, altitude=-self.table_height
64
63
  )
65
64
  self.table = table
66
- self.scene_objects: List[sapien.Entity] = [self.table, self.ground]
65
+ self.scene_objects: list[sapien.Entity] = [self.table, self.ground]
67
66
 
68
67
  def initialize(self, env_idx: torch.Tensor):
69
68
  # table_height = 0.9196429
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass
4
4
  from functools import cached_property
5
- from typing import TYPE_CHECKING, List, Literal, Optional, Union
5
+ from typing import TYPE_CHECKING, Literal, Optional, Union
6
6
 
7
7
  import numpy as np
8
8
  import sapien
@@ -57,7 +57,7 @@ class Actor(PhysxRigidDynamicComponentStruct[sapien.Entity]):
57
57
  @classmethod
58
58
  def create_from_entities(
59
59
  cls,
60
- entities: List[sapien.Entity],
60
+ entities: list[sapien.Entity],
61
61
  scene: ManiSkillScene,
62
62
  scene_idxs: torch.Tensor,
63
63
  shared_name: Optional[str] = None,
@@ -97,7 +97,7 @@ class Actor(PhysxRigidDynamicComponentStruct[sapien.Entity]):
97
97
  )
98
98
 
99
99
  @classmethod
100
- def merge(cls, actors: List["Actor"], name: str = None):
100
+ def merge(cls, actors: list["Actor"], name: str = None):
101
101
  """
102
102
  Merge actors together under one view so that they can all be managed by one python dataclass object.
103
103
  This can be useful for e.g. randomizing the asset loaded into a task and being able to do object.pose to fetch the pose of all randomized assets
@@ -106,7 +106,7 @@ class Actor(PhysxRigidDynamicComponentStruct[sapien.Entity]):
106
106
  For example usage of this method, see mani_skill/envs/tasks/pick_single_ycb.py
107
107
 
108
108
  Args:
109
- actors (List[Actor]): The actors to merge into one actor object to manage
109
+ actors (list[Actor]): The actors to merge into one actor object to manage
110
110
  name (str): A new name to give the merged actors. If none, the name will default to the first actor's name
111
111
  """
112
112
  objs = []
@@ -259,7 +259,7 @@ class Actor(PhysxRigidDynamicComponentStruct[sapien.Entity]):
259
259
 
260
260
  def get_collision_meshes(
261
261
  self, to_world_frame: bool = True, first_only: bool = False
262
- ) -> Union[List[trimesh.Trimesh], trimesh.Trimesh]:
262
+ ) -> Union[list[trimesh.Trimesh], trimesh.Trimesh]:
263
263
  """
264
264
  Returns the collision mesh of each managed actor object. Note results of this are not cached or optimized at the moment
265
265
  so this function can be slow if called too often. Some actors have no collision meshes, in which case this function returns an empty list.
@@ -274,7 +274,7 @@ class Actor(PhysxRigidDynamicComponentStruct[sapien.Entity]):
274
274
  not self.merged
275
275
  ), "Currently you cannot fetch collision meshes of merged actors"
276
276
 
277
- meshes: List[trimesh.Trimesh] = []
277
+ meshes: list[trimesh.Trimesh] = []
278
278
 
279
279
  for i, actor in enumerate(self._objs):
280
280
  actor_meshes = []
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  from collections import defaultdict
4
4
  from dataclasses import dataclass, field
5
5
  from functools import cached_property
6
- from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
6
+ from typing import TYPE_CHECKING, Optional, Tuple, Union
7
7
 
8
8
  import numpy as np
9
9
  import sapien
@@ -30,19 +30,19 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
30
30
  Wrapper around physx.PhysxArticulation objects
31
31
  """
32
32
 
33
- links: List[Link]
34
- """List of Link objects"""
35
- links_map: Dict[str, Link]
33
+ links: list[Link]
34
+ """list of Link objects"""
35
+ links_map: dict[str, Link]
36
36
  """Maps link name to the Link object"""
37
37
  root: Link
38
38
  """The root Link object"""
39
- joints: List[ArticulationJoint]
40
- """List of Joint objects"""
41
- joints_map: Dict[str, ArticulationJoint]
39
+ joints: list[ArticulationJoint]
40
+ """list of Joint objects"""
41
+ joints_map: dict[str, ArticulationJoint]
42
42
  """Maps joint name to the Joint object"""
43
- active_joints: List[ArticulationJoint]
44
- """List of active Joint objects, referencing elements in self.joints"""
45
- active_joints_map: Dict[str, ArticulationJoint]
43
+ active_joints: list[ArticulationJoint]
44
+ """list of active Joint objects, referencing elements in self.joints"""
45
+ active_joints_map: dict[str, ArticulationJoint]
46
46
  """Maps active joint name to the Joint object, referencing elements in self.joints"""
47
47
 
48
48
  name: str = None
@@ -60,10 +60,10 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
60
60
  longer make "sense"
61
61
  """
62
62
 
63
- _cached_joint_target_indices: Dict[int, torch.Tensor] = field(default_factory=dict)
63
+ _cached_joint_target_indices: dict[int, torch.Tensor] = field(default_factory=dict)
64
64
  """Map from a set of joints of this articulation and the indexing torch tensor to use for setting drive targets in GPU sims."""
65
65
 
66
- _net_contact_force_queries: Dict[
66
+ _net_contact_force_queries: dict[
67
67
  Tuple, physx.PhysxGpuContactBodyImpulseQuery
68
68
  ] = field(default_factory=dict)
69
69
  """Maps a tuple of link names to pre-saved net contact force queries"""
@@ -80,7 +80,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
80
80
  @classmethod
81
81
  def create_from_physx_articulations(
82
82
  cls,
83
- physx_articulations: List[physx.PhysxArticulation],
83
+ physx_articulations: list[physx.PhysxArticulation],
84
84
  scene: ManiSkillScene,
85
85
  scene_idxs: torch.Tensor,
86
86
  _merged: bool = False,
@@ -111,15 +111,15 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
111
111
  )
112
112
  # create link and joint structs
113
113
  num_links = max([len(x.links) for x in physx_articulations])
114
- all_links_objs: List[List[physx.PhysxArticulationLinkComponent]] = [
114
+ all_links_objs: list[list[physx.PhysxArticulationLinkComponent]] = [
115
115
  [] for _ in range(num_links)
116
116
  ]
117
117
  num_joints = max([len(x.joints) for x in physx_articulations])
118
- all_joint_objs: List[List[physx.PhysxArticulationJoint]] = [
118
+ all_joint_objs: list[list[physx.PhysxArticulationJoint]] = [
119
119
  [] for _ in range(num_joints)
120
120
  ]
121
121
 
122
- links_map: Dict[str, Link] = dict()
122
+ links_map: dict[str, Link] = dict()
123
123
  for articulation in physx_articulations:
124
124
  if _process_links:
125
125
  assert num_links == len(articulation.links) and num_joints == len(
@@ -130,7 +130,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
130
130
  all_links_objs[i].append(link)
131
131
  for i, joint in enumerate(articulation.joints):
132
132
  all_joint_objs[i].append(joint)
133
- wrapped_links: List[Link] = []
133
+ wrapped_links: list[Link] = []
134
134
 
135
135
  root = None
136
136
  for links in all_links_objs:
@@ -164,7 +164,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
164
164
  ]
165
165
 
166
166
  joints_map = dict()
167
- wrapped_joints: List[ArticulationJoint] = []
167
+ wrapped_joints: list[ArticulationJoint] = []
168
168
  for joint_index, joints in enumerate(all_joint_objs):
169
169
  try:
170
170
  active_joint_index = all_active_joint_names.index(
@@ -223,7 +223,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
223
223
  @classmethod
224
224
  def merge(
225
225
  cls,
226
- articulations: List["Articulation"],
226
+ articulations: list["Articulation"],
227
227
  name: str = None,
228
228
  merge_links: bool = False,
229
229
  ):
@@ -343,7 +343,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
343
343
 
344
344
  def get_collision_meshes(
345
345
  self, to_world_frame: bool = True, first_only: bool = False
346
- ) -> Union[List[trimesh.Trimesh], trimesh.Trimesh]:
346
+ ) -> Union[list[trimesh.Trimesh], trimesh.Trimesh]:
347
347
  """
348
348
  Returns the collision mesh of each managed articulation object. Note results of this are not cached or optimized at the moment
349
349
  so this function can be slow if called too often
@@ -365,7 +365,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
365
365
  else:
366
366
  self._objs[0].pose = self._objs[0].pose
367
367
  # TODO (stao): Can we have a batched version of trimesh?
368
- meshes: List[trimesh.Trimesh] = []
368
+ meshes: list[trimesh.Trimesh] = []
369
369
 
370
370
  for i, art in enumerate(self._objs):
371
371
  art_meshes = []
@@ -396,7 +396,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
396
396
 
397
397
  def get_visual_meshes(
398
398
  self, to_world_frame: bool = True, first_only: bool = False
399
- ) -> List[trimesh.Trimesh]:
399
+ ) -> list[trimesh.Trimesh]:
400
400
  """
401
401
  Returns the visual mesh of each managed articulation object. Note results of this are not cached or optimized at the moment
402
402
  so this function can be slow if called too often
@@ -411,7 +411,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
411
411
  initialization, and link poses are needed to get the correct visual mesh of an entire articulation"
412
412
  else:
413
413
  self._objs[0].pose = self._objs[0].pose
414
- meshes: List[trimesh.Trimesh] = []
414
+ meshes: list[trimesh.Trimesh] = []
415
415
  for i, art in enumerate(self._objs):
416
416
  art_meshes = []
417
417
  for link in art.links:
@@ -438,7 +438,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
438
438
  return meshes[0]
439
439
  return meshes
440
440
 
441
- def get_net_contact_impulses(self, link_names: Union[List[str], Tuple[str]]):
441
+ def get_net_contact_impulses(self, link_names: Union[list[str], Tuple[str]]):
442
442
  """Get net contact impulses for several links together. This should be faster compared to using
443
443
  link.get_net_contact_impulses on each link.
444
444
 
@@ -487,7 +487,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
487
487
  net_impulse[i] = common.to_tensor(total_impulse)
488
488
  return net_impulse[None, :]
489
489
 
490
- def get_net_contact_forces(self, link_names: Union[List[str], Tuple[str]]):
490
+ def get_net_contact_forces(self, link_names: Union[list[str], Tuple[str]]):
491
491
  """Get net contact forces for several links together. This should be faster compared to using
492
492
  link.get_net_contact_forces on each link.
493
493
 
@@ -497,7 +497,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
497
497
  return self.get_net_contact_impulses(link_names) / self.scene.timestep
498
498
 
499
499
  def get_joint_target_indices(
500
- self, joint_indices: Union[Array, List[int], List[ArticulationJoint]]
500
+ self, joint_indices: Union[Array, list[int], list[ArticulationJoint]]
501
501
  ):
502
502
  """
503
503
  Gets the meshgrid indexes for indexing px.cuda_articulation_target_* values given a 1D list of joint indexes or a 1D list of ArticulationJoint objects.
@@ -873,7 +873,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
873
873
  def set_joint_drive_targets(
874
874
  self,
875
875
  targets: Array,
876
- joints: Optional[List[ArticulationJoint]] = None,
876
+ joints: Optional[list[ArticulationJoint]] = None,
877
877
  joint_indices: Optional[torch.Tensor] = None,
878
878
  ):
879
879
  """
@@ -888,7 +888,8 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
888
888
  else:
889
889
  gx, gy = self.get_joint_target_indices(joint_indices)
890
890
  self.px.cuda_articulation_target_qpos.torch()[
891
- gx[self.scene._reset_mask[self._scene_idxs]], gy[self.scene._reset_mask[self._scene_idxs]]
891
+ gx[self.scene._reset_mask[self._scene_idxs]],
892
+ gy[self.scene._reset_mask[self._scene_idxs]],
892
893
  ] = targets
893
894
  else:
894
895
  for i, joint in enumerate(joints):
@@ -897,7 +898,7 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
897
898
  def set_joint_drive_velocity_targets(
898
899
  self,
899
900
  targets: Array,
900
- joints: Optional[List[ArticulationJoint]] = None,
901
+ joints: Optional[list[ArticulationJoint]] = None,
901
902
  joint_indices: Optional[torch.Tensor] = None,
902
903
  ):
903
904
  """
@@ -912,7 +913,8 @@ class Articulation(BaseStruct[physx.PhysxArticulation]):
912
913
  else:
913
914
  gx, gy = self.get_joint_target_indices(joint_indices)
914
915
  self.px.cuda_articulation_target_qvel.torch()[
915
- gx[self.scene._reset_mask[self._scene_idxs]], gy[self.scene._reset_mask[self._scene_idxs]]
916
+ gx[self.scene._reset_mask[self._scene_idxs]],
917
+ gy[self.scene._reset_mask[self._scene_idxs]],
916
918
  ] = targets
917
919
  else:
918
920
  for i, joint in enumerate(joints):