-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Replaces set_carb_setting and get_carb_setting with direct carb calls
#3922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pascal-roth
wants to merge
2
commits into
isaac-sim:main
Choose a base branch
from
pascal-roth:feature/remove-carb-utils
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+55
−37
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,6 @@ | |
| import omni.usd | ||
| 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 | ||
|
|
@@ -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. | ||
|
|
@@ -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 | ||
|
|
@@ -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: | ||
|
|
@@ -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(): | ||
|
|
@@ -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): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In simcontext, we have a function called |
||
| 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 | ||
|
|
@@ -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: | ||
|
|
@@ -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.""" | ||
|
|
@@ -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.""" | ||
|
|
@@ -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 | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:23imports and usesget_carb_settingon line 1075scripts/tools/check_instanceable.py:70imports and usesset_carb_settingon line 99These should be updated to use direct carb API calls for consistency.