Skip to content

Commit

Permalink
adds check for multi-asset spawning
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayankm96 committed Oct 9, 2024
1 parent df51fb2 commit 1378991
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ def clone_environments(self, copy_from_source: bool = False):
copy_from_source=copy_from_source,
)

# check if user spawned different assets in individual environments
# this flag will be None if no multi asset is spawned
carb_settings_iface = carb.settings.get_settings()
has_multi_assets = carb_settings_iface.get("/isaaclab/spawn/multi_assets")
if has_multi_assets and self.cfg.replicate_physics:
carb.log_warn(
"Varying assets might have been spawned under different environments."
" However, the replicate physics flag is enabled in the 'InteractiveScene' configuration."
" This may adversely affect PhysX parsing. We recommend disabling this property."
)

# in case of heterogeneous cloning, the env origins is specified at init
if self._default_env_origins is None:
self._default_env_origins = torch.tensor(env_origins, device=self.device, dtype=torch.float32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re
from typing import TYPE_CHECKING

import carb
import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.core.utils.stage as stage_utils
from pxr import Sdf, Usd
Expand Down Expand Up @@ -108,6 +109,12 @@ def spawn_multi_asset(
# delete the dataset prim after spawning
prim_utils.delete_prim(template_prim_path)

# set carb setting to indicate Isaac Lab's environments that different prims have been spawned
# at varying prim paths. In this case, PhysX parser shouldn't optimize the stage parsing.
# the flag is mainly used to inform the user that they should disable `InteractiveScene.replicate_physics`
carb_settings_iface = carb.settings.get_settings()
carb_settings_iface.set_bool("/isaaclab/spawn/multi_assets", True)

# return the prim
return prim_utils.get_prim_at_path(prim_paths[0])

Expand Down

0 comments on commit 1378991

Please sign in to comment.