Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions source/isaaclab/isaaclab/app/app_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,6 @@ def _hide_stop_button(self):
def _set_rendering_mode_settings(self, launcher_args: dict) -> None:
"""Store RTX rendering mode in carb settings."""
import carb
from isaacsim.core.utils.carb import set_carb_setting

rendering_mode = launcher_args.get("rendering_mode")

Expand All @@ -895,12 +894,11 @@ def _set_rendering_mode_settings(self, launcher_args: dict) -> None:

# store rendering mode in carb settings
carb_settings = carb.settings.get_settings()
set_carb_setting(carb_settings, "/isaaclab/rendering/rendering_mode", rendering_mode)
carb_settings.set_string("/isaaclab/rendering/rendering_mode", rendering_mode)

def _set_animation_recording_settings(self, launcher_args: dict) -> None:
"""Store animation recording settings in carb settings."""
import carb
from isaacsim.core.utils.carb import set_carb_setting

# check if recording is enabled
recording_enabled = launcher_args.get("anim_recording_enabled", False)
Expand All @@ -920,9 +918,9 @@ def _set_animation_recording_settings(self, launcher_args: dict) -> None:

# store config in carb settings
carb_settings = carb.settings.get_settings()
set_carb_setting(carb_settings, "/isaaclab/anim_recording/enabled", recording_enabled)
set_carb_setting(carb_settings, "/isaaclab/anim_recording/start_time", start_time)
set_carb_setting(carb_settings, "/isaaclab/anim_recording/stop_time", stop_time)
carb_settings.set_bool("/isaaclab/anim_recording/enabled", recording_enabled)
carb_settings.set_float("/isaaclab/anim_recording/start_time", start_time)
carb_settings.set_float("/isaaclab/anim_recording/stop_time", stop_time)

def _interrupt_signal_handle_callback(self, signal, frame):
"""Handle the interrupt signal from the keyboard."""
Expand Down
64 changes: 45 additions & 19 deletions source/isaaclab/isaaclab/sim/simulation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import omni.usd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Two files still import and use the deprecated carb utils but weren't updated:

  • source/isaaclab/isaaclab/sim/utils.py:23 imports and uses get_carb_setting on line 1075
  • scripts/tools/check_instanceable.py:70 imports and uses set_carb_setting on line 99

These should be updated to use direct carb API calls for consistency.

from isaacsim.core.api.simulation_context import SimulationContext as _SimulationContext
from isaacsim.core.simulation_manager import SimulationManager
from isaacsim.core.utils.carb import get_carb_setting, set_carb_setting
from isaacsim.core.utils.viewports import set_camera_view
from isaacsim.core.version import get_version
from pxr import Gf, PhysxSchema, Sdf, Usd, UsdPhysics
Expand Down Expand Up @@ -653,10 +652,10 @@ def _apply_physics_settings(self):
"""Sets various carb physics settings."""
# enable hydra scene-graph instancing
# note: this allows rendering of instanceable assets on the GUI
set_carb_setting(self.carb_settings, "/persistent/omnihydra/useSceneGraphInstancing", True)
self.carb_settings.set_bool("/persistent/omnihydra/useSceneGraphInstancing", True)
# change dispatcher to use the default dispatcher in PhysX SDK instead of carb tasking
# note: dispatcher handles how threads are launched for multi-threaded physics
set_carb_setting(self.carb_settings, "/physics/physxDispatcher", True)
self.carb_settings.set_bool("/physics/physxDispatcher", True)
# disable contact processing in omni.physx
# note: we disable it by default to avoid the overhead of contact processing when it isn't needed.
# The physics flag gets enabled when a contact sensor is created.
Expand All @@ -668,16 +667,16 @@ def _apply_physics_settings(self):
)
# FIXME: From investigation, it seems this flag only affects CPU physics. For GPU physics, contacts
# are always processed. The issue is reported to the PhysX team by @mmittal.
set_carb_setting(self.carb_settings, "/physics/disableContactProcessing", True)
self.carb_settings.set_bool("/physics/disableContactProcessing", True)
# disable custom geometry for cylinder and cone collision shapes to allow contact reporting for them
# reason: cylinders and cones aren't natively supported by PhysX so we need to use custom geometry flags
# reference: https://nvidia-omniverse.github.io/PhysX/physx/5.4.1/docs/Geometry.html?highlight=capsule#geometry
set_carb_setting(self.carb_settings, "/physics/collisionConeCustomGeometry", False)
set_carb_setting(self.carb_settings, "/physics/collisionCylinderCustomGeometry", False)
self.carb_settings.set_bool("/physics/collisionConeCustomGeometry", False)
self.carb_settings.set_bool("/physics/collisionCylinderCustomGeometry", False)
# hide the Simulation Settings window
set_carb_setting(self.carb_settings, "/physics/autoPopupSimulationOutputWindow", False)
self.carb_settings.set_bool("/physics/autoPopupSimulationOutputWindow", False)

def _apply_render_settings_from_cfg(self):
def _apply_render_settings_from_cfg(self): # noqa: C901
"""Sets rtx settings specified in the RenderCfg."""

# define mapping of user-friendly RenderCfg names to native carb names
Expand All @@ -701,7 +700,7 @@ def _apply_render_settings_from_cfg(self):
# 1. command line argument --rendering_mode, if provided
# 2. rendering_mode from Render Config, if set
# 3. lastly, default to "balanced" mode, if neither is specified
rendering_mode = get_carb_setting(self.carb_settings, "/isaaclab/rendering/rendering_mode")
rendering_mode = self.carb_settings.get("/isaaclab/rendering/rendering_mode")
if not rendering_mode:
rendering_mode = self.cfg.render.rendering_mode
if not rendering_mode:
Expand Down Expand Up @@ -731,7 +730,16 @@ def _apply_render_settings_from_cfg(self):
# set presets
for key, value in preset_dict.items():
key = "/" + key.replace(".", "/") # convert to carb setting format
set_carb_setting(self.carb_settings, key, value)
if isinstance(value, bool):
self.carb_settings.set_bool(key, value)
elif isinstance(value, int):
self.carb_settings.set_int(key, value)
elif isinstance(value, float):
self.carb_settings.set_float(key, value)
elif isinstance(value, str):
self.carb_settings.set_string(key, value)
else:
raise ValueError(f"Unsupported value type: {type(value)}")

# set user-friendly named settings
for key, value in vars(self.cfg.render).items():
Expand All @@ -744,7 +752,16 @@ def _apply_render_settings_from_cfg(self):
" need to be updated."
)
key = rendering_setting_name_mapping[key]
set_carb_setting(self.carb_settings, key, value)
if isinstance(value, bool):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In simcontext, we have a function called set_setting you can just put this logic there and later only call self.set_setting.

self.carb_settings.set_bool(key, value)
elif isinstance(value, int):
self.carb_settings.set_int(key, value)
elif isinstance(value, float):
self.carb_settings.set_float(key, value)
elif isinstance(value, str):
self.carb_settings.set_string(key, value)
else:
raise ValueError(f"Unsupported value type: {type(value)}")

# set general carb settings
carb_settings = self.cfg.render.carb_settings
Expand All @@ -754,9 +771,18 @@ def _apply_render_settings_from_cfg(self):
key = "/" + key.replace("_", "/") # convert from python variable style string
elif "." in key:
key = "/" + key.replace(".", "/") # convert from .kit file style string
if get_carb_setting(self.carb_settings, key) is None:
if self.carb_settings.get(key) is None:
raise ValueError(f"'{key}' in RenderCfg.general_parameters does not map to a carb setting.")
set_carb_setting(self.carb_settings, key, value)
if isinstance(value, bool):
self.carb_settings.set_bool(key, value)
elif isinstance(value, int):
self.carb_settings.set_int(key, value)
elif isinstance(value, float):
self.carb_settings.set_float(key, value)
elif isinstance(value, str):
self.carb_settings.set_string(key, value)
else:
raise ValueError(f"Unsupported value type: {type(value)}")

# set denoiser mode
if self.cfg.render.antialiasing_mode is not None:
Expand All @@ -768,8 +794,8 @@ def _apply_render_settings_from_cfg(self):
pass

# WAR: Ensure /rtx/renderMode RaytracedLighting is correctly cased.
if get_carb_setting(self.carb_settings, "/rtx/rendermode").lower() == "raytracedlighting":
set_carb_setting(self.carb_settings, "/rtx/rendermode", "RaytracedLighting")
if self.carb_settings.get("/rtx/rendermode").lower() == "raytracedlighting":
self.carb_settings.set_string("/rtx/rendermode", "RaytracedLighting")

def _set_additional_physx_params(self):
"""Sets additional PhysX parameters that are not directly supported by the parent class."""
Expand Down Expand Up @@ -881,10 +907,10 @@ def _setup_anim_recording(self):
self._physxPvdInterface = _physxPvd.acquire_physx_pvd_interface()

# Set carb settings for the output path and enabling pvd recording
set_carb_setting(
self.carb_settings, "/persistent/physics/omniPvdOvdRecordingDirectory", self._anim_recording_output_dir
self.carb_settings.set_string(
"/persistent/physics/omniPvdOvdRecordingDirectory", self._anim_recording_output_dir
)
set_carb_setting(self.carb_settings, "/physics/omniPvdOutputEnabled", True)
self.carb_settings.set_bool("/physics/omniPvdOutputEnabled", True)

def _update_usda_start_time(self, file_path, start_time):
"""Updates the start time of the USDA baked anim recordingfile."""
Expand Down Expand Up @@ -949,7 +975,7 @@ def _finish_anim_recording(self):
)

# Disable recording
set_carb_setting(self.carb_settings, "/physics/omniPvdOutputEnabled", False)
self.carb_settings.set_bool("/physics/omniPvdOutputEnabled", False)

return result

Expand Down
3 changes: 1 addition & 2 deletions source/isaaclab/test/deps/isaacsim/check_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import omni.replicator.core as rep
from isaacsim.core.api.world import World
from isaacsim.core.prims import Articulation, RigidPrim, SingleGeometryPrim, SingleRigidPrim
from isaacsim.core.utils.carb import set_carb_setting
from isaacsim.core.utils.viewports import set_camera_view
from PIL import Image, ImageChops
from pxr import Gf, UsdGeom
Expand Down Expand Up @@ -85,7 +84,7 @@ def main():
world.get_physics_context().enable_flatcache(True)
# Enable hydra scene-graph instancing
# this is needed to visualize the scene when flatcache is enabled
set_carb_setting(world._settings, "/persistent/omnihydra/useSceneGraphInstancing", True)
world._settings.set_bool("/persistent/omnihydra/useSceneGraphInstancing", True)

# Populate scene
# Ground
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import omni.physx
from isaacsim.core.api.world import World
from isaacsim.core.prims import Articulation
from isaacsim.core.utils.carb import set_carb_setting
from isaacsim.core.utils.viewports import set_camera_view
from pxr import PhysxSchema, UsdPhysics

Expand Down Expand Up @@ -75,7 +74,7 @@ def main():

# Enable hydra scene-graph instancing
# this is needed to visualize the scene when flatcache is enabled
set_carb_setting(world._settings, "/persistent/omnihydra/useSceneGraphInstancing", True)
world._settings.set_bool("/persistent/omnihydra/useSceneGraphInstancing", True)

# Spawn things into stage
# Ground-plane
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
from isaacsim.core.api.world import World
from isaacsim.core.cloner import GridCloner
from isaacsim.core.prims import Articulation
from isaacsim.core.utils.carb import set_carb_setting
from isaacsim.core.utils.viewports import set_camera_view

# check nucleus connection
Expand Down Expand Up @@ -89,7 +88,7 @@ def main():

# Enable hydra scene-graph instancing
# this is needed to visualize the scene when flatcache is enabled
set_carb_setting(world._settings, "/persistent/omnihydra/useSceneGraphInstancing", True)
world._settings.set_bool("/persistent/omnihydra/useSceneGraphInstancing", True)

# Create interface to clone the scene
cloner = GridCloner(spacing=2.0)
Expand Down
3 changes: 1 addition & 2 deletions source/isaaclab/test/deps/isaacsim/check_ref_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import isaacsim.core.utils.prims as prim_utils
from isaacsim.core.api.simulation_context import SimulationContext
from isaacsim.core.prims import Articulation
from isaacsim.core.utils.carb import set_carb_setting

# check nucleus connection
if nucleus_utils.get_assets_root_path() is None:
Expand Down Expand Up @@ -110,7 +109,7 @@ def main():

# Enable hydra scene-graph instancing
# this is needed to visualize the scene when flatcache is enabled
set_carb_setting(sim._settings, "/persistent/omnihydra/useSceneGraphInstancing", True)
sim._settings.set_bool("/persistent/omnihydra/useSceneGraphInstancing", True)

# Create a dummy tensor for testing
# Uncommenting the following line will yield a reference count of 1 for the robot (as desired)
Expand Down
3 changes: 1 addition & 2 deletions source/isaaclab/test/sensors/check_contact_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import isaacsim.core.utils.prims as prim_utils
from isaacsim.core.api.simulation_context import SimulationContext
from isaacsim.core.cloner import GridCloner
from isaacsim.core.utils.carb import set_carb_setting
from isaacsim.core.utils.viewports import set_camera_view

import isaaclab.sim as sim_utils
Expand Down Expand Up @@ -83,7 +82,7 @@ def main():

# Enable hydra scene-graph instancing
# this is needed to visualize the scene when flatcache is enabled
set_carb_setting(sim._settings, "/persistent/omnihydra/useSceneGraphInstancing", True)
sim._settings.set_bool("/persistent/omnihydra/useSceneGraphInstancing", True)

# Create interface to clone the scene
cloner = GridCloner(spacing=2.0)
Expand Down
3 changes: 1 addition & 2 deletions source/isaaclab/test/sim/test_simulation_render_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import carb
import flatdict
import pytest
from isaacsim.core.utils.carb import get_carb_setting
from isaacsim.core.version import get_version

from isaaclab.sim.simulation_cfg import RenderCfg, SimulationCfg
Expand Down Expand Up @@ -142,7 +141,7 @@ def test_render_cfg_presets():
# grab groundtruth from preset
setting_gt = val

setting_val = get_carb_setting(carb_settings_iface, setting_name)
setting_val = carb_settings_iface.get(setting_name)

assert setting_gt == setting_val

Expand Down
Loading