@@ -201,8 +201,6 @@ def __init__(
201201
202202 self ._env = self ._world .get_env ()
203203
204- self ._default_resources = SimResources ()
205-
206204 # set unique material path to accelerate material creation.
207205 # TODO: This will be removed.
208206 if self .sim_config .enable_rt is False :
@@ -235,15 +233,56 @@ def __init__(
235233 # The structure is keys to the loaded texture data. The keys represent the texture group.
236234 self ._texture_cache : Dict [str , Union [torch .Tensor , List [torch .Tensor ]]] = dict ()
237235
238- # TODO: maybe need to add some interface to interact with background and layouts.
239- # background and layouts are 3d assets that can has only render body for visualization.
236+ self ._init_sim_resources ()
240237
241238 self ._create_default_plane ()
242239 self .set_default_background ()
243240
244241 # Set physics to manual update mode by default.
245242 self .set_manual_update (True )
246243
244+ @property
245+ def num_envs (self ) -> int :
246+ """Get the number of arenas in the simulation.
247+
248+ Returns:
249+ int: number of arenas.
250+ """
251+ return len (self ._arenas ) if len (self ._arenas ) > 0 else 1
252+
253+ @cached_property
254+ def is_use_gpu_physics (self ) -> bool :
255+ """Check if the physics simulation is using GPU."""
256+ world_config = dexsim .get_world_config ()
257+ return self .device .type == "cuda" and world_config .enable_gpu_sim
258+
259+ @property
260+ def is_rt_enabled (self ) -> bool :
261+ """Check if Ray Tracing rendering backend is enabled."""
262+ return self .sim_config .enable_rt
263+
264+ @property
265+ def is_physics_manually_update (self ) -> bool :
266+ return self ._world .is_physics_manually_update ()
267+
268+ @property
269+ def asset_uids (self ) -> List [str ]:
270+ """Get all assets uid in the simulation.
271+
272+ The assets include lights, sensors, robots, rigid objects and articulations.
273+
274+ Returns:
275+ List[str]: list of all assets uid.
276+ """
277+ uid_list = ["default_plane" ]
278+ uid_list .extend (list (self ._lights .keys ()))
279+ uid_list .extend (list (self ._sensors .keys ()))
280+ uid_list .extend (list (self ._robots .keys ()))
281+ uid_list .extend (list (self ._rigid_objects .keys ()))
282+ uid_list .extend (list (self ._rigid_object_groups .keys ()))
283+ uid_list .extend (list (self ._articulations .keys ()))
284+ return uid_list
285+
247286 def _convert_sim_config (
248287 self , sim_config : SimulationManagerCfg
249288 ) -> dexsim .WorldConfig :
@@ -295,47 +334,9 @@ def get_default_resources(self) -> SimResources:
295334 """
296335 return self ._default_resources
297336
298- @property
299- def num_envs (self ) -> int :
300- """Get the number of arenas in the simulation.
301-
302- Returns:
303- int: number of arenas.
304- """
305- return len (self ._arenas ) if len (self ._arenas ) > 0 else 1
306-
307- @cached_property
308- def is_use_gpu_physics (self ) -> bool :
309- """Check if the physics simulation is using GPU."""
310- world_config = dexsim .get_world_config ()
311- return self .device .type == "cuda" and world_config .enable_gpu_sim
312-
313- @property
314- def is_rt_enabled (self ) -> bool :
315- """Check if Ray Tracing rendering backend is enabled."""
316- return self .sim_config .enable_rt
317-
318- @property
319- def is_physics_manually_update (self ) -> bool :
320- return self ._world .is_physics_manually_update ()
321-
322- @property
323- def asset_uids (self ) -> List [str ]:
324- """Get all assets uid in the simulation.
325-
326- The assets include lights, sensors, robots, rigid objects and articulations.
327-
328- Returns:
329- List[str]: list of all assets uid.
330- """
331- uid_list = ["default_plane" ]
332- uid_list .extend (list (self ._lights .keys ()))
333- uid_list .extend (list (self ._sensors .keys ()))
334- uid_list .extend (list (self ._robots .keys ()))
335- uid_list .extend (list (self ._rigid_objects .keys ()))
336- uid_list .extend (list (self ._rigid_object_groups .keys ()))
337- uid_list .extend (list (self ._articulations .keys ()))
338- return uid_list
337+ def _init_sim_resources (self ) -> None :
338+ """Initialize the default simulation resources."""
339+ self ._default_resources = SimResources ()
339340
340341 def enable_physics (self , enable : bool ) -> None :
341342 """Enable or disable physics simulation.
0 commit comments