Repository navigation
Add Multi Data Types, Simulation Backends, and Rendering Backends for Cartpole - #4816
kellyguo11 merged 11 commits into
Conversation
2e735ed to
53fab9a
Compare
…velop/cartpole-NewtonSim-RTXRender
53fab9a to
d2f918c
Compare
Greptile SummaryThis PR extends the Cartpole camera-preset environment with multi-physics and multi-renderer backends (Newton + RTX, PhysX + RTX, Newton + Warp renderer), adds a Newton physics preset to the locomotion velocity env, and refactors several RL training/play scripts to use Key concerns found during review:
Confidence Score: 1/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Script as play.py / train.py
participant ML1 as AppLauncher (module-level)
participant Main as main()
participant LS as launch_simulation()
participant ML2 as AppLauncher (sim_launcher)
participant NM as NewtonManager
participant CUDA as CUDA Graph
Script->>ML1: AppLauncher(args_cli) [NEW - module level]
ML1-->>Script: simulation_app
Script->>Main: main() via @hydra_task_config
Main->>LS: launch_simulation(env_cfg, args_cli)
Note over LS: needs_kit = has_kit_cameras OR not is_newton
LS->>ML2: AppLauncher(launcher_args) [CONFLICT: 2nd init]
Main->>NM: reset() → initialize_solver()
NM->>CUDA: wp.ScopedCapture → _simulate()
Note over CUDA: Graph capture begins
NM->>NM: sync_state_to_usd() [PROBLEM: called inside graph]
NM->>CUDA: wp.synchronize() + .numpy() [NOT graph-compatible]
Note over CUDA: Graph capture ends (broken)
Last reviewed commit: d2f918c |
| class MultiBackendRendererCfg(PresetCfg): | ||
| default: IsaacRtxRendererCfg = IsaacRtxRendererCfg() | ||
| newton_renderer: NewtonWarpRendererCfg = NewtonWarpRendererCfg() | ||
| isaac_sim_rtx: IsaacRtxRendererCfg = default | ||
|
|
There was a problem hiding this comment.
Shared object reference / aliasing between default and isaac_sim_rtx
isaac_sim_rtx: IsaacRtxRendererCfg = default assigns the same object reference as default to isaac_sim_rtx. Because both names point to the single IsaacRtxRendererCfg() instance created on the first line of the class body, mutating one attribute (e.g. cfg.isaac_sim_rtx.some_field = ...) will silently also change cfg.default. This is a classic mutable-default aliasing bug in dataclass-style configs.
To get an independent copy, use:
| class MultiBackendRendererCfg(PresetCfg): | |
| default: IsaacRtxRendererCfg = IsaacRtxRendererCfg() | |
| newton_renderer: NewtonWarpRendererCfg = NewtonWarpRendererCfg() | |
| isaac_sim_rtx: IsaacRtxRendererCfg = default | |
| @configclass | |
| class MultiBackendRendererCfg(PresetCfg): | |
| default: IsaacRtxRendererCfg = IsaacRtxRendererCfg() | |
| newton_renderer: NewtonWarpRendererCfg = NewtonWarpRendererCfg() | |
| isaac_sim_rtx: IsaacRtxRendererCfg = IsaacRtxRendererCfg() |
|
|
||
| @configclass | ||
| class MultiBackendRendererCfg(PresetCfg): | ||
| default: IsaacRtxRendererCfg = IsaacRtxRendererCfg() |
There was a problem hiding this comment.
can you make this change to
from isaaclab_tasks.utils.presets import MultiBackendRendererCfg?
also @kellyguo11 what do you think the final naming for presets under MultiBackendRendererCfg?
we definitely don't want ovrtx, but do we finalize to isaac_sim_rtx?
There was a problem hiding this comment.
Re-added MultiBackendRendererCfg import
Additionally, greptile commented to make
isaac_sim_rtx: IsaacRtxRendererCfg = default
into
isaac_sim_rtx: IsaacRtxRendererCfg = IsaacRtxRendererCfg
But I think that is fine?
There was a problem hiding this comment.
class MultiBackendRendererCfg(PresetCfg):
default: IsaacRtxRendererCfg = IsaacRtxRendererCfg()
newton_renderer: NewtonWarpRendererCfg = NewtonWarpRendererCfg()
ovrtx_renderer: OVRTXRendererCfg = OVRTXRendererCfg()
isaacsim_rtx_renderer = default
I think Piotr changed to this ^^^, maybe we can do something consistent?
There was a problem hiding this comment.
I see the difference: I'll change isaac_sim_rtx to isaacsim_rtx_renderer.
|
|
||
| @configclass | ||
| class MultiBackendRendererCfg(PresetCfg): | ||
| default: IsaacRtxRendererCfg = IsaacRtxRendererCfg() |
There was a problem hiding this comment.
Re-added MultiBackendRendererCfg import
Additionally, greptile commented to make
isaac_sim_rtx: IsaacRtxRendererCfg = default
into
isaac_sim_rtx: IsaacRtxRendererCfg = IsaacRtxRendererCfg
But I think that is fine?
|
|
||
| # Sync Newton state to USD/Fabric for RTX rendering (e.g., Newton Physics + RTX Renderer preset) | ||
| if cls._usdrt_stage is not None: | ||
| cls.sync_transforms_to_usd() |
There was a problem hiding this comment.
Hey, @ooctipus . I cannot jump/respond to your previous comment, but I noticed that in develop that sync_transforms_to_usd was used for the Kit viewer. I instead use it for updating the RTX transforms and added https://github.com/isaac-sim/IsaacLab/pull/4816/changes#diff-bf71fc0993ef30acc0b03f2c6f2feb3aa39b8c2b9951cc7458e1b5e52c3759cbR177.
b6bf8d3 to
f5b5a48
Compare
| wp.synchronize_device(PhysicsManager._device) | ||
| if hasattr(usdrt, "hierarchy") and usdrt.hierarchy: | ||
| try: | ||
| fabric_hierarchy = usdrt.hierarchy.IFabricHierarchy().get_fabric_hierarchy( |
There was a problem hiding this comment.
do you need the try: except: logic here? is there anycase if it fails we don't want to report?
| device=PhysicsManager._device, | ||
| ) | ||
| wp.synchronize_device(PhysicsManager._device) | ||
| if hasattr(usdrt, "hierarchy") and usdrt.hierarchy: |
There was a problem hiding this comment.
| if hasattr(usdrt, "hierarchy") and usdrt.hierarchy: | |
| if hasattr(usdrt, "hierarchy"): |
the and usdrt.hierarchy seems redundant? is it a boolean?
|
@bdilinila do you mind filling in some information for the description of the PR? just a quick sentence or two on what the change is for and why it was needed. |
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there