1919import torch
2020import os
2121import random
22- from typing import TYPE_CHECKING , Literal , Union , Optional , Dict
22+ from typing import TYPE_CHECKING , Literal , Union , Dict
2323
2424from embodichain .lab .sim .objects import Light , RigidObject , Articulation
2525from embodichain .lab .sim .sensors import Camera , StereoCamera
@@ -55,11 +55,11 @@ def randomize_camera_extrinsics(
5555 env : EmbodiedEnv ,
5656 env_ids : Union [torch .Tensor , None ],
5757 entity_cfg : SceneEntityCfg ,
58- pos_range : Optional [ tuple [list [float ], list [float ]]] = None ,
59- euler_range : Optional [ tuple [list [float ], list [float ]]] = None ,
60- eye_range : Optional [ tuple [list [float ], list [float ]]] = None ,
61- target_range : Optional [ tuple [list [float ], list [float ]]] = None ,
62- up_range : Optional [ tuple [list [float ], list [float ]]] = None ,
58+ pos_range : tuple [list [float ], list [float ]] | None = None ,
59+ euler_range : tuple [list [float ], list [float ]] | None = None ,
60+ eye_range : tuple [list [float ], list [float ]] | None = None ,
61+ target_range : tuple [list [float ], list [float ]] | None = None ,
62+ up_range : tuple [list [float ], list [float ]] | None = None ,
6363) -> None :
6464 """
6565 Randomize camera extrinsic properties (position and orientation).
@@ -177,9 +177,9 @@ def randomize_light(
177177 env : EmbodiedEnv ,
178178 env_ids : Union [torch .Tensor , None ],
179179 entity_cfg : SceneEntityCfg ,
180- position_range : Optional [ tuple [list [float ], list [float ]]] = None ,
181- color_range : Optional [ tuple [list [float ], list [float ]]] = None ,
182- intensity_range : Optional [ tuple [float , float ]] = None ,
180+ position_range : tuple [list [float ], list [float ]] | None = None ,
181+ color_range : tuple [list [float ], list [float ]] | None = None ,
182+ intensity_range : tuple [float , float ] | None = None ,
183183) -> None :
184184 """Randomize light properties by adding, scaling, or setting random values.
185185
@@ -205,9 +205,9 @@ def randomize_light(
205205 env (EmbodiedEnv): The environment instance.
206206 env_ids (Union[torch.Tensor, None]): The environment IDs to apply the randomization.
207207 entity_cfg (SceneEntityCfg): The configuration of the scene entity to randomize.
208- position_range (Optional[ tuple[list[float], list[float]]] ): The range for the position randomization.
209- color_range (Optional[ tuple[list[float], list[float]]] ): The range for the color randomization.
210- intensity_range (Optional[ tuple[float, float]] ): The range for the intensity randomization.
208+ position_range (tuple[list[float], list[float]] | None ): The range for the position randomization.
209+ color_range (tuple[list[float], list[float]] | None ): The range for the color randomization.
210+ intensity_range (tuple[float, float] | None ): The range for the intensity randomization.
211211 """
212212
213213 light : Light = env .sim .get_light (entity_cfg .uid )
@@ -259,10 +259,10 @@ def randomize_camera_intrinsics(
259259 env : EmbodiedEnv ,
260260 env_ids : Union [torch .Tensor , None ],
261261 entity_cfg : SceneEntityCfg ,
262- focal_x_range : Optional [ tuple [float , float ]] = None ,
263- focal_y_range : Optional [ tuple [float , float ]] = None ,
264- cx_range : Optional [ tuple [float , float ]] = None ,
265- cy_range : Optional [ tuple [float , float ]] = None ,
262+ focal_x_range : tuple [float , float ] | None = None ,
263+ focal_y_range : tuple [float , float ] | None = None ,
264+ cx_range : tuple [float , float ] | None = None ,
265+ cy_range : tuple [float , float ] | None = None ,
266266) -> None :
267267 """Randomize camera intrinsic properties by adding, scaling, or setting random values.
268268
@@ -289,10 +289,10 @@ def randomize_camera_intrinsics(
289289 env (EmbodiedEnv): The environment instance.
290290 env_ids (Union[torch.Tensor, None]): The environment IDs to apply the randomization.
291291 entity_cfg (SceneEntityCfg): The configuration of the scene entity to randomize.
292- focal_x_range (Optional[ tuple[float, float]] ): The range for the focal length x randomization.
293- focal_y_range (Optional[ tuple[float, float]] ): The range for the focal length y randomization.
294- cx_range (Optional[ tuple[float, float]] ): The range for the principal point x randomization.
295- cy_range (Optional[ tuple[float, float]] ): The range for the principal point y randomization.
292+ focal_x_range (tuple[float, float] | None ): The range for the focal length x randomization.
293+ focal_y_range (tuple[float, float] | None ): The range for the focal length y randomization.
294+ cx_range (tuple[float, float] | None ): The range for the principal point x randomization.
295+ cy_range (tuple[float, float] | None ): The range for the principal point y randomization.
296296 """
297297
298298 camera : Union [Camera , StereoCamera ] = env .sim .get_sensor (entity_cfg .uid )
@@ -500,11 +500,11 @@ def __call__(
500500 env_ids : Union [torch .Tensor , None ],
501501 entity_cfg : SceneEntityCfg ,
502502 random_texture_prob : float = 0.5 ,
503- texture_path : Optional [ str ] = None ,
504- base_color_range : Optional [ tuple [list [float ], list [float ]]] = None ,
505- metallic_range : Optional [ tuple [float , float ]] = None ,
506- roughness_range : Optional [ tuple [float , float ]] = None ,
507- ior_range : Optional [ tuple [float , float ]] = None ,
503+ texture_path : str | None = None ,
504+ base_color_range : tuple [list [float ], list [float ]] | None = None ,
505+ metallic_range : tuple [float , float ] | None = None ,
506+ roughness_range : tuple [float , float ] | None = None ,
507+ ior_range : tuple [float , float ] | None = None ,
508508 ):
509509 from embodichain .lab .sim .utility import is_rt_enabled
510510
0 commit comments