Skip to content

Remove hardcoded camera prim paths from OVRTX renderer#4843

Merged
kellyguo11 merged 1 commit intoisaac-sim:developfrom
ncournia-nv:dev/ncournia/remove-hardcoded-paths
Mar 6, 2026
Merged

Remove hardcoded camera prim paths from OVRTX renderer#4843
kellyguo11 merged 1 commit intoisaac-sim:developfrom
ncournia-nv:dev/ncournia/remove-hardcoded-paths

Conversation

@ncournia-nv
Copy link
Collaborator

Remove hardcoded camera prim paths from OVRTX renderer

Derive the camera prim path from the sensor's resolved view prims
instead of assuming it is always "Camera". This fixes scenes where the
camera lives at a non-default path (e.g. Robot/ee_link/palm_link/Camera).

  • Extract camera relative path from sensor._view at initialization
  • Use it for camera bindings, scene partitions, object binding filter,
    and USD camera injection
  • Discover cameras by USD type (UsdGeom.Camera) in create_cloning_attributes
    instead of matching on the "Camera" string
  • Add ovrtx_renderer preset to cartpole camera presets env config

@ncournia-nv ncournia-nv requested a review from kellyguo11 as a code owner March 6, 2026 01:14
@github-actions github-actions bot added the isaac-lab Related to Isaac Lab team label Mar 6, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 6, 2026

Greptile Summary

This PR removes hardcoded "Camera" prim name assumptions from the OVRTX renderer, instead deriving the camera's relative USD path dynamically from sensor._view.prims[0] and propagating it through camera bindings, scene partition writes, USD injection, and the object-binding filter. Camera discovery in create_cloning_attributes is also updated to use the USD type system (UsdGeom.Camera) rather than string matching. A new OVRTXRendererCfg preset is added to the cartpole camera presets env config.

  • ovrtx_renderer.py: _camera_rel_path is extracted once in initialize() from sensor._view.prims[0] and reused consistently wherever camera prim paths are constructed — camera bindings, omni:resetXformStack writes, scene partition updates, and the Newton object-binding filter. A bounds check on the prims list should be added to provide clear error messages when misconfigured.
  • ovrtx_usd.py: create_cloning_attributes drops the camera_prim_name parameter; cameras are now detected by prim.IsA(UsdGeom.Camera) and receive omni:scenePartition (without primvars: prefix), matching the original per-camera attribute semantics. inject_cameras_into_usd gains a camera_rel_path keyword argument (default "Camera") used to build per-env camera paths in the injected Render scope.
  • cartpole_camera_presets_env_cfg.py: OVRTXRendererCfg is added as a named preset in MultiBackendRendererCfg, enabling the cartpole camera task to exercise the OVRTX renderer without additional config changes.

Confidence Score: 4/5

  • Safe to merge; the core refactoring logic is correct and meaningfully improves flexibility for non-default camera paths.
  • This PR successfully removes hardcoded camera path assumptions and propagates the derived path correctly through all call sites. The refactor is well-scoped and the extracted _camera_rel_path is consistently used. The main robustness gap is the unguarded sensor._view.prims[0] access in initialize(), which would surface as a confusing IndexError if the sensor view is misconfigured. Adding a bounds check with a clear error message is a simple improvement that prevents unhelpful error messages in edge cases. No functional regressions identified.
  • source/isaaclab_ov/isaaclab_ov/renderers/ovrtx_renderer.py — add bounds check before accessing sensor._view.prims[0]

Important Files Changed

Filename Overview
source/isaaclab_ov/isaaclab_ov/renderers/ovrtx_renderer.py Derives camera relative path from sensor._view.prims[0] and propagates it through camera bindings, scene partitions, and object-binding filters. Logic is sound; minor robustness improvement needed: add a bounds check on sensor._view.prims before indexing to provide clear error messages on misconfiguration.
source/isaaclab_ov/isaaclab_ov/renderers/ovrtx_usd.py Removes camera_prim_name parameter; discovers cameras via UsdGeom.Camera type check and propagates camera_rel_path into USD injection. Clean and correct refactor with no issues.
source/isaaclab_tasks/isaaclab_tasks/direct/cartpole/cartpole_camera_presets_env_cfg.py Adds OVRTXRendererCfg as a preset option in MultiBackendRendererCfg. Straightforward addition with no issues.

Sequence Diagram

sequenceDiagram
    participant S as Simulation
    participant R as OVRTXRenderer
    participant USD as ovrtx_usd
    participant SV as sensor._view

    S->>R: prepare_stage(stage, num_envs)
    R->>USD: create_cloning_attributes(stage, num_envs, use_cloning)
    Note over USD: Discovers cameras via UsdGeom.Camera type,<br/>no longer relies on hardcoded "Camera" name
    USD-->>R: total_objects count
    R->>USD: export_stage_for_ovrtx(stage, path, num_envs)
    R->>R: store _exported_usd_path

    S->>R: initialize(sensor)
    R->>SV: prims[0].GetPath().pathString
    SV-->>R: first_cam_path (e.g. /World/envs/env_0/Robot/ee_link/Camera)
    R->>R: _camera_rel_path = "Robot/ee_link/Camera"
    R->>USD: inject_cameras_into_usd(..., camera_rel_path)
    Note over USD: Builds camera_paths using dynamic rel_path<br/>instead of hardcoded "Camera"
    USD-->>R: (combined_usd_path, render_product_path)
    R->>R: _update_scene_partitions_after_clone<br/>(uses _camera_rel_path)
    R->>R: camera_paths = [/World/envs/env_i/{_camera_rel_path}]
    R->>R: bind_attribute(camera_paths, "omni:xform")
    R->>R: _setup_object_bindings<br/>(filters via _camera_rel_path substring)
Loading

Last reviewed commit: ffac2e9

@fatimaanes fatimaanes self-requested a review March 6, 2026 01:35
Copy link
Collaborator

@ooctipus ooctipus left a comment

Choose a reason for hiding this comment

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

its already a lot less hardcoded than before, : D Maybe you can let user pass in /World/envs/env_.* as default argument if user doesn't have any other prefix preference. that will somewhat address the hardcoding concern.

Derive the camera prim path from the sensor's resolved view prims
instead of assuming it is always "Camera". This fixes scenes where the
camera lives at a non-default path (e.g. Robot/ee_link/palm_link/Camera).

- Extract camera relative path from sensor._view at initialization
- Use it for camera bindings, scene partitions, object binding filter,
  and USD camera injection
- Discover cameras by USD type (UsdGeom.Camera) in create_cloning_attributes
  instead of matching on the "Camera" string
@ncournia-nv ncournia-nv force-pushed the dev/ncournia/remove-hardcoded-paths branch from ffac2e9 to 04ec48b Compare March 6, 2026 17:24
@kellyguo11 kellyguo11 merged commit 33dfb05 into isaac-sim:develop Mar 6, 2026
4 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants