Skip to content

Adds benchmarking presets configuration to Shadow Hand Vision - #4845

Merged
kellyguo11 merged 2 commits into
isaac-sim:developfrom
kellyguo11:shadow-hand-vision
Mar 6, 2026
Merged

kellyguo11 merged 2 commits into
isaac-sim:developfrom
kellyguo11:shadow-hand-vision

Conversation

@kellyguo11

Copy link
Copy Markdown
Contributor

Description

Adds multi-physics and multi-render backend configuration presets to shadow hand vision task. also adds a variation for benchmarking that disables the CNN update.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@kellyguo11
kellyguo11 requested a review from hhansen-bdai as a code owner March 6, 2026 03:44
@github-actions github-actions Bot added isaac-lab Related to Isaac Lab team infrastructure labels Mar 6, 2026
@greptile-apps

greptile-apps Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds multi-physics (PhysX / Newton) and multi-render-backend (IsaacRTX / Warp / OVRTX) configuration presets to the Shadow Hand Vision task, along with a new ShadowHandVisionBenchmarkEnvCfg that disables the CNN forward pass to isolate rendering throughput during profiling.

Key changes:

  • Preset system: New ShadowHandVisionTiledCameraCfg and ShadowHandVisionRendererCfg preset classes allow renderer and camera data-type selection via CLI arguments (e.g., presets=warp,rgb).
  • Dynamic CNN channel count: FeatureExtractor and FeatureExtractorNetwork now derive the number of input channels from the resolved camera data_types list, removing the need for a separate env config class per modality.
  • Newton compatibility: ShadowHandSceneCfg disables clone_in_fabric for Newton; body_incoming_joint_wrench_b calls are wrapped in try/except NotImplementedError in both inhand_manipulation_env.py and shadow_hand_vision_env.py.
  • Validation: _validate_cfg raises early ValueError for unsupported renderer/data-type combinations (e.g., Warp + semantic segmentation, depth-only with CNN enabled).
  • Tests: A comprehensive new test file covers unit validation, preset resolution, and integration render-correctness cases with appropriate xfail marks for known Newton + IsaacRTX incompatibility.
  • Bug: In _preprocess_images, depth tensors are modified in-place without cloning, which corrupts the live camera sensor buffer — inconsistent with _save_images, which correctly clones before mutating.

Confidence Score: 2/5

  • PR contains a logic bug where depth tensors are mutated in-place, corrupting the live camera sensor buffer.
  • The PR is well-designed overall, but contains one critical logic bug in feature_extractor._preprocess_images: depth tensors are modified in-place without cloning, directly corrupting self._tiled_camera.data.output["depth"]. This inconsistency with _save_images (which correctly clones) confirms the omission is unintentional. Any code that reads the depth sensor output after feature_extractor.step() within the same environment step will observe normalized [0,1] values instead of original depth distances. Until this is fixed, the PR should not merge.
  • source/isaaclab_tasks/isaaclab_tasks/direct/shadow_hand/feature_extractor.py — specifically the depth branch of _preprocess_images (lines 204–209).

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    CLI["CLI: presets=warp,rgb"] --> RC[resolve_preset_defaults]
    RC --> VCfg[ShadowHandVisionEnvCfg / BenchmarkEnvCfg]

    VCfg --> |tiled_camera preset| TC["_ShadowHandBaseTiledCameraCfg\n(data_types, renderer_cfg)"]
    VCfg --> |feature_extractor| FE["FeatureExtractorCfg\n(enabled, train, ...)"]

    subgraph ShadowHandVisionEnv.__init__
        VAL["_validate_cfg(cfg)"]
        FE_INIT["FeatureExtractor(cfg, device,\ncfg.tiled_camera.data_types)"]
    end

    TC --> VAL
    FE --> VAL
    VAL -->|"warp + unsupported type\nor depth-only + CNN enabled"| ERR["ValueError raised early"]
    VAL -->|valid| FE_INIT

    FE_INIT --> FEN["FeatureExtractorNetwork\n(num_channel=Σ channels,\ndata_types)"]

    subgraph Per-step: _compute_image_observations
        STEP["feature_extractor.step\n(camera_output, gt_pose)"]
        STEP --> |enabled=False| ZERO["Return zeros (27-d)"]
        STEP --> |enabled=True| PP["_preprocess_images\n(dict → (N,H,W,C) tensor)"]
        PP --> CNN["CNN forward → predicted_pose"]
        STEP --> |train=True| LOSS["MSE loss + backward"]
    end

    FEN --> STEP
Loading

Last reviewed commit: e91ff9c

Comment on lines +204 to +209
elif dt == "depth":
img[img == float("inf")] = 0
img /= 5.0
max_val = img.max()
if max_val > 0:
img /= max_val

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In-place mutation of depth sensor buffer

_preprocess_images modifies the depth tensor in-place without cloning it first. camera_output[dt].float() returns the same underlying storage when the tensor is already float32 (which Isaac Sim depth sensors produce). The three in-place operations (img[img == float("inf")] = 0, img /= 5.0, img /= max_val) therefore directly corrupt self._tiled_camera.data.output["depth"] — the sensor's own internal buffer.

This is inconsistent with _save_images (lines 234–239), which correctly calls .clone() on the depth tensor before any in-place modification.

After feature_extractor.step() returns, any caller that reads self._tiled_camera.data.output["depth"] within the same environment step will see normalized [0, 1] values instead of the original depth distances.

Suggested change
elif dt == "depth":
img[img == float("inf")] = 0
img /= 5.0
max_val = img.max()
if max_val > 0:
img /= max_val
elif dt == "depth":
img = img.clone()
img[img == float("inf")] = 0
img /= 5.0
max_val = img.max()
if max_val > 0:
img /= max_val

warp: NewtonWarpRendererCfg = NewtonWarpRendererCfg()
"""Newton Warp software renderer."""

ovrtx: OVRTXRendererCfg = OVRTXRendererCfg()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe we can import the shared on, so we don't end up different naming conventions : D

"""
renderer_type = getattr(cfg.tiled_camera.renderer_cfg, "renderer_type", None)
if renderer_type == "newton_warp":
unsupported = set(cfg.tiled_camera.data_types) - _WARP_SUPPORTED_DATA_TYPES

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a small observation, something we could address in the future - this should be done by camera. If we request output types unsupported by the renderer we should throw or produce a warning.

ValueError: If the Warp renderer is paired with an unsupported data type, or if a
depth-only camera is used without disabling the feature extractor.
"""
renderer_type = getattr(cfg.tiled_camera.renderer_cfg, "renderer_type", None)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be happening through isinstance(NewtonRendererConfg), the renderer_type is impl detail. We can address this later.

@kellyguo11
kellyguo11 merged commit 0ac0ee8 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

infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants