@@ -449,7 +449,17 @@ def set_setting(self, name: str, value: Any):
449449 name: The name of the setting.
450450 value: The value of the setting.
451451 """
452- self ._settings .set (name , value )
452+ # Route through typed setters for correctness and consistency.
453+ if isinstance (value , bool ):
454+ self ._settings .set_bool (name , value )
455+ elif isinstance (value , int ):
456+ self ._settings .set_int (name , value )
457+ elif isinstance (value , float ):
458+ self ._settings .set_float (name , value )
459+ elif isinstance (value , str ):
460+ self ._settings .set_string (name , value )
461+ else :
462+ raise ValueError (f"Unsupported value type for setting '{ name } ': { type (value )} " )
453463
454464 def get_setting (self , name : str ) -> Any :
455465 """Read the simulation setting using the Carbonite SDK.
@@ -652,10 +662,10 @@ def _apply_physics_settings(self):
652662 """Sets various carb physics settings."""
653663 # enable hydra scene-graph instancing
654664 # note: this allows rendering of instanceable assets on the GUI
655- self .carb_settings . set_bool ("/persistent/omnihydra/useSceneGraphInstancing" , True )
665+ self .set_setting ("/persistent/omnihydra/useSceneGraphInstancing" , True )
656666 # change dispatcher to use the default dispatcher in PhysX SDK instead of carb tasking
657667 # note: dispatcher handles how threads are launched for multi-threaded physics
658- self .carb_settings . set_bool ("/physics/physxDispatcher" , True )
668+ self .set_setting ("/physics/physxDispatcher" , True )
659669 # disable contact processing in omni.physx
660670 # note: we disable it by default to avoid the overhead of contact processing when it isn't needed.
661671 # The physics flag gets enabled when a contact sensor is created.
@@ -667,14 +677,14 @@ def _apply_physics_settings(self):
667677 )
668678 # FIXME: From investigation, it seems this flag only affects CPU physics. For GPU physics, contacts
669679 # are always processed. The issue is reported to the PhysX team by @mmittal.
670- self .carb_settings . set_bool ("/physics/disableContactProcessing" , True )
680+ self .set_setting ("/physics/disableContactProcessing" , True )
671681 # disable custom geometry for cylinder and cone collision shapes to allow contact reporting for them
672682 # reason: cylinders and cones aren't natively supported by PhysX so we need to use custom geometry flags
673683 # reference: https://nvidia-omniverse.github.io/PhysX/physx/5.4.1/docs/Geometry.html?highlight=capsule#geometry
674- self .carb_settings . set_bool ("/physics/collisionConeCustomGeometry" , False )
675- self .carb_settings . set_bool ("/physics/collisionCylinderCustomGeometry" , False )
684+ self .set_setting ("/physics/collisionConeCustomGeometry" , False )
685+ self .set_setting ("/physics/collisionCylinderCustomGeometry" , False )
676686 # hide the Simulation Settings window
677- self .carb_settings . set_bool ("/physics/autoPopupSimulationOutputWindow" , False )
687+ self .set_setting ("/physics/autoPopupSimulationOutputWindow" , False )
678688
679689 def _apply_render_settings_from_cfg (self ): # noqa: C901
680690 """Sets rtx settings specified in the RenderCfg."""
@@ -700,7 +710,7 @@ def _apply_render_settings_from_cfg(self): # noqa: C901
700710 # 1. command line argument --rendering_mode, if provided
701711 # 2. rendering_mode from Render Config, if set
702712 # 3. lastly, default to "balanced" mode, if neither is specified
703- rendering_mode = self .carb_settings . get ("/isaaclab/rendering/rendering_mode" )
713+ rendering_mode = self .get_setting ("/isaaclab/rendering/rendering_mode" )
704714 if not rendering_mode :
705715 rendering_mode = self .cfg .render .rendering_mode
706716 if not rendering_mode :
@@ -730,16 +740,7 @@ def _apply_render_settings_from_cfg(self): # noqa: C901
730740 # set presets
731741 for key , value in preset_dict .items ():
732742 key = "/" + key .replace ("." , "/" ) # convert to carb setting format
733- if isinstance (value , bool ):
734- self .carb_settings .set_bool (key , value )
735- elif isinstance (value , int ):
736- self .carb_settings .set_int (key , value )
737- elif isinstance (value , float ):
738- self .carb_settings .set_float (key , value )
739- elif isinstance (value , str ):
740- self .carb_settings .set_string (key , value )
741- else :
742- raise ValueError (f"Unsupported value type: { type (value )} " )
743+ self .set_setting (key , value )
743744
744745 # set user-friendly named settings
745746 for key , value in vars (self .cfg .render ).items ():
@@ -752,16 +753,7 @@ def _apply_render_settings_from_cfg(self): # noqa: C901
752753 " need to be updated."
753754 )
754755 key = rendering_setting_name_mapping [key ]
755- if isinstance (value , bool ):
756- self .carb_settings .set_bool (key , value )
757- elif isinstance (value , int ):
758- self .carb_settings .set_int (key , value )
759- elif isinstance (value , float ):
760- self .carb_settings .set_float (key , value )
761- elif isinstance (value , str ):
762- self .carb_settings .set_string (key , value )
763- else :
764- raise ValueError (f"Unsupported value type: { type (value )} " )
756+ self .set_setting (key , value )
765757
766758 # set general carb settings
767759 carb_settings = self .cfg .render .carb_settings
@@ -771,18 +763,9 @@ def _apply_render_settings_from_cfg(self): # noqa: C901
771763 key = "/" + key .replace ("_" , "/" ) # convert from python variable style string
772764 elif "." in key :
773765 key = "/" + key .replace ("." , "/" ) # convert from .kit file style string
774- if self .carb_settings . get (key ) is None :
766+ if self .get_setting (key ) is None :
775767 raise ValueError (f"'{ key } ' in RenderCfg.general_parameters does not map to a carb setting." )
776- if isinstance (value , bool ):
777- self .carb_settings .set_bool (key , value )
778- elif isinstance (value , int ):
779- self .carb_settings .set_int (key , value )
780- elif isinstance (value , float ):
781- self .carb_settings .set_float (key , value )
782- elif isinstance (value , str ):
783- self .carb_settings .set_string (key , value )
784- else :
785- raise ValueError (f"Unsupported value type: { type (value )} " )
768+ self .set_setting (key , value )
786769
787770 # set denoiser mode
788771 if self .cfg .render .antialiasing_mode is not None :
@@ -794,8 +777,9 @@ def _apply_render_settings_from_cfg(self): # noqa: C901
794777 pass
795778
796779 # WAR: Ensure /rtx/renderMode RaytracedLighting is correctly cased.
797- if self .carb_settings .get ("/rtx/rendermode" ).lower () == "raytracedlighting" :
798- self .carb_settings .set_string ("/rtx/rendermode" , "RaytracedLighting" )
780+ rendermode_val = self .get_setting ("/rtx/rendermode" )
781+ if isinstance (rendermode_val , str ) and rendermode_val .lower () == "raytracedlighting" :
782+ self .set_setting ("/rtx/rendermode" , "RaytracedLighting" )
799783
800784 def _set_additional_physx_params (self ):
801785 """Sets additional PhysX parameters that are not directly supported by the parent class."""
@@ -907,10 +891,8 @@ def _setup_anim_recording(self):
907891 self ._physxPvdInterface = _physxPvd .acquire_physx_pvd_interface ()
908892
909893 # Set carb settings for the output path and enabling pvd recording
910- self .carb_settings .set_string (
911- "/persistent/physics/omniPvdOvdRecordingDirectory" , self ._anim_recording_output_dir
912- )
913- self .carb_settings .set_bool ("/physics/omniPvdOutputEnabled" , True )
894+ self .set_setting ("/persistent/physics/omniPvdOvdRecordingDirectory" , self ._anim_recording_output_dir )
895+ self .set_setting ("/physics/omniPvdOutputEnabled" , True )
914896
915897 def _update_usda_start_time (self , file_path , start_time ):
916898 """Updates the start time of the USDA baked anim recordingfile."""
@@ -975,7 +957,7 @@ def _finish_anim_recording(self):
975957 )
976958
977959 # Disable recording
978- self .carb_settings . set_bool ("/physics/omniPvdOutputEnabled" , False )
960+ self .set_setting ("/physics/omniPvdOutputEnabled" , False )
979961
980962 return result
981963
0 commit comments