mani-skill-nightly 2025.6.14.814__py3-none-any.whl → 2025.6.14.2004__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.
@@ -1,9 +1,11 @@
1
- from dataclasses import dataclass
2
- from typing import Any, Dict, Tuple
1
+ from dataclasses import asdict, dataclass
2
+ from typing import Any, Dict, Sequence, Union
3
3
 
4
+ import dacite
4
5
  import numpy as np
5
6
  import sapien
6
7
  import torch
8
+ from sapien.render import RenderBodyComponent
7
9
  from transforms3d.euler import euler2quat
8
10
 
9
11
  import mani_skill.envs.utils.randomization as randomization
@@ -25,9 +27,10 @@ from mani_skill.utils.structs.types import GPUMemoryConfig, SimConfig
25
27
  class SO100GraspCubeDomainRandomizationConfig:
26
28
  ### task agnostic domain randomizations, many of which you can copy over to your own tasks ###
27
29
  initial_qpos_noise_scale: float = 0.02
28
- randomize_robot_color: bool = True
30
+ robot_color: Union[str, Sequence[float]] = (1, 1, 1)
31
+ """Color of the robot in RGB format in scale of 0 to 1 mapping to 0 to 255. If you want to randomize it just set this value to "random"."""
29
32
  randomize_lighting: bool = True
30
- max_camera_offset: Tuple[float, float, float] = (0.025, 0.025, 0.025)
33
+ max_camera_offset: Sequence[float] = (0.025, 0.025, 0.025)
31
34
  """max camera offset from the base camera position in x, y, and z axes"""
32
35
  camera_target_noise: float = 1e-3
33
36
  """scale of noise added to the camera target position"""
@@ -37,12 +40,15 @@ class SO100GraspCubeDomainRandomizationConfig:
37
40
  """scale of noise added to the camera fov"""
38
41
 
39
42
  ### task-specific related domain randomizations that occur during scene loading ###
40
- cube_half_size_range: Tuple[float, float] = (0.022 / 2, 0.028 / 2)
43
+ cube_half_size_range: Sequence[float] = (0.022 / 2, 0.028 / 2)
41
44
  cube_friction_mean: float = 0.3
42
45
  cube_friction_std: float = 0.05
43
- cube_friction_bounds: Tuple[float, float] = (0.1, 0.5)
46
+ cube_friction_bounds: Sequence[float] = (0.1, 0.5)
44
47
  randomize_cube_color: bool = True
45
48
 
49
+ def dict(self):
50
+ return {k: v for k, v in asdict(self).items()}
51
+
46
52
 
47
53
  @register_env("SO100GraspCube-v1", max_episode_steps=64)
48
54
  class SO100GraspCubeEnv(BaseDigitalTwinEnv):
@@ -69,7 +75,9 @@ class SO100GraspCubeEnv(BaseDigitalTwinEnv):
69
75
  robot_uids="so100",
70
76
  control_mode="pd_joint_target_delta_pos",
71
77
  greenscreen_overlay_path=None,
72
- domain_randomization_config=SO100GraspCubeDomainRandomizationConfig(),
78
+ domain_randomization_config: Union[
79
+ SO100GraspCubeDomainRandomizationConfig, dict
80
+ ] = SO100GraspCubeDomainRandomizationConfig(),
73
81
  domain_randomization=True,
74
82
  base_camera_settings=dict(
75
83
  fov=52 * np.pi / 180,
@@ -82,8 +90,18 @@ class SO100GraspCubeEnv(BaseDigitalTwinEnv):
82
90
  ):
83
91
  self.domain_randomization = domain_randomization
84
92
  """whether randomization is turned on or off."""
85
- self.domain_randomization_config = domain_randomization_config
93
+ self.domain_randomization_config = SO100GraspCubeDomainRandomizationConfig()
86
94
  """domain randomization config"""
95
+ merged_domain_randomization_config = self.domain_randomization_config.dict()
96
+ if isinstance(domain_randomization_config, dict):
97
+ common.dict_merge(
98
+ merged_domain_randomization_config, domain_randomization_config
99
+ )
100
+ self.domain_randomization_config = dacite.from_dict(
101
+ data_class=SO100GraspCubeDomainRandomizationConfig,
102
+ data=domain_randomization_config,
103
+ config=dacite.Config(strict=True),
104
+ )
87
105
  self.base_camera_settings = base_camera_settings
88
106
  """what the camera fov, position and target are when domain randomization is off. DR is centered around these settings"""
89
107
 
@@ -142,7 +160,12 @@ class SO100GraspCubeEnv(BaseDigitalTwinEnv):
142
160
  def _load_agent(self, options: dict):
143
161
  # load the robot arm at this initial pose
144
162
  super()._load_agent(
145
- options, sapien.Pose(p=[0, 0, 0], q=euler2quat(0, 0, np.pi / 2))
163
+ options,
164
+ sapien.Pose(p=[0, 0, 0], q=euler2quat(0, 0, np.pi / 2)),
165
+ build_separate=True
166
+ if self.domain_randomization
167
+ and self.domain_randomization_config.robot_color == "random"
168
+ else False,
146
169
  )
147
170
 
148
171
  def _load_lighting(self, options: dict):
@@ -251,6 +274,33 @@ class SO100GraspCubeEnv(BaseDigitalTwinEnv):
251
274
  builder.initial_pose = sapien.Pose()
252
275
  self.camera_mount = builder.build_kinematic("camera_mount")
253
276
 
277
+ # randomize or set a fixed robot color
278
+ for link in self.agent.robot.links:
279
+ for i, obj in enumerate(link._objs):
280
+ # modify the i-th object which is in parallel environment i
281
+ render_body_component: RenderBodyComponent = (
282
+ obj.entity.find_component_by_type(RenderBodyComponent)
283
+ )
284
+ if render_body_component is not None:
285
+ for render_shape in render_body_component.render_shapes:
286
+ for part in render_shape.parts:
287
+ if (
288
+ self.domain_randomization
289
+ and self.domain_randomization_config.robot_color
290
+ == "random"
291
+ ):
292
+ part.material.set_base_color(
293
+ self._batched_episode_rng[i]
294
+ .uniform(low=0.0, high=1.0, size=(3,))
295
+ .tolist()
296
+ + [1]
297
+ )
298
+ else:
299
+ part.material.set_base_color(
300
+ list(self.domain_randomization_config.robot_color)
301
+ + [1]
302
+ )
303
+
254
304
  def sample_camera_poses(self, n: int):
255
305
  # a custom function to sample random camera poses
256
306
  # the way this works is we first sample "eyes", which are the camera positions
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mani-skill-nightly
3
- Version: 2025.6.14.814
3
+ Version: 2025.6.14.2004
4
4
  Summary: ManiSkill3: A Unified Benchmark for Generalizable Manipulation Skills
5
5
  Home-page: https://github.com/haosulab/ManiSkill
6
6
  Author: ManiSkill contributors
@@ -569,7 +569,7 @@ mani_skill/envs/tasks/digital_twins/bridge_dataset_eval/__init__.py,sha256=2okxy
569
569
  mani_skill/envs/tasks/digital_twins/bridge_dataset_eval/base_env.py,sha256=HFjZwcMOSNduDmyD-qo9zVeHqHOdXdx0H11japbTpEI,21997
570
570
  mani_skill/envs/tasks/digital_twins/bridge_dataset_eval/put_on_in_scene.py,sha256=kDKEX-e1Hq5kZiBs9xfEzU2jjx35eHWriAAYFJcBbgE,9419
571
571
  mani_skill/envs/tasks/digital_twins/so100_arm/__init__.py,sha256=uehHSCaHoZDB9awMtF81r4A-X4fM6NFmErzOsgzgSs4,42
572
- mani_skill/envs/tasks/digital_twins/so100_arm/grasp_cube.py,sha256=vJMNx6tmPVMP1ttiB0AMo-a5PhQR0y8GBsbu2X_GR3E,19397
572
+ mani_skill/envs/tasks/digital_twins/so100_arm/grasp_cube.py,sha256=U0ldL-lDMipcjEUhrlWvn5Kzh_r1TkkjfdUxj9OGyX0,21875
573
573
  mani_skill/envs/tasks/drawing/__init__.py,sha256=eZ7CnzIWBOHUihvOKStSQK94eKSv5wchRdSodiDYBlw,72
574
574
  mani_skill/envs/tasks/drawing/draw.py,sha256=WlhxJjt0-DlkxC3t-o0M8BoOwdwWpM9reupFg5OqiZc,8146
575
575
  mani_skill/envs/tasks/drawing/draw_svg.py,sha256=UKnVl_tMfUNHmOg24Ny-wFynb5CaZC0uIHvW9sBxbyo,16206
@@ -824,8 +824,8 @@ mani_skill/vector/wrappers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
824
824
  mani_skill/vector/wrappers/gymnasium.py,sha256=0kNe_iquf8J3503obkbmCKNaYr5m3cPrC_hBZS0Nl9Y,7408
825
825
  mani_skill/vector/wrappers/sb3.py,sha256=SlXdiEPqcNHYMhJCzA29kBU6zK7DKTe1nc0L6Z3QQtY,4722
826
826
  mani_skill/viewer/__init__.py,sha256=srvDBsk4LQU75K2VIttrhiQ68p_ro7PSDqQRls2PY5c,1722
827
- mani_skill_nightly-2025.6.14.814.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
828
- mani_skill_nightly-2025.6.14.814.dist-info/METADATA,sha256=5xnWX8qPJnA3aZ-J_IYKKIhiKte0AsNTrdTuoHUKS9A,9271
829
- mani_skill_nightly-2025.6.14.814.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
830
- mani_skill_nightly-2025.6.14.814.dist-info/top_level.txt,sha256=bkBgOVl_MZMoQx2aRFsSFEYlZLxjWlip5vtJ39FB3jA,11
831
- mani_skill_nightly-2025.6.14.814.dist-info/RECORD,,
827
+ mani_skill_nightly-2025.6.14.2004.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
828
+ mani_skill_nightly-2025.6.14.2004.dist-info/METADATA,sha256=apDEpbBIfYmUimW8Nsj_OP8RHhfx_UH4q8I8wCfb2jY,9272
829
+ mani_skill_nightly-2025.6.14.2004.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
830
+ mani_skill_nightly-2025.6.14.2004.dist-info/top_level.txt,sha256=bkBgOVl_MZMoQx2aRFsSFEYlZLxjWlip5vtJ39FB3jA,11
831
+ mani_skill_nightly-2025.6.14.2004.dist-info/RECORD,,