Skip to content

Add Franka camera benchmark environments - #6647

Closed
huidongc wants to merge 2 commits into
isaac-sim:developfrom
huidongc:franka-envs-for-benchmarking
Closed

huidongc wants to merge 2 commits into
isaac-sim:developfrom
huidongc:franka-envs-for-benchmarking

Conversation

@huidongc

@huidongc huidongc commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add benchmark-only camera variants for Franka cloth and soft-body lifting across supported physics and renderer presets.

Reuse these configurations in rendering tests and exclude benchmark tasks from generated training documentation.

Benchmark script example:

# Only newton_mjwarp_vbd is supported for franka_cloth.
for physics in newton_mjwarp_vbd; do
    for renderer in ovrtx newton_renderer isaacsim_rtx; do
        echo -e "\033[1;36m==================================================================\033[0m"
        echo -e "\033[1;36m Benchmark: physics='${physics}', renderer='${renderer}' \033[0m"
        echo -e "\033[1;36m==================================================================\033[0m"

        ./isaaclab.sh -p scripts/benchmarks/runtime.py \
            --task Isaac-Lift-Cloth-Franka-Camera-Benchmark \
            --enable_cameras --headless \
            physics="${physics}" \
            renderer="${renderer}" \
            presets=rgb \
            --seed 42 \
            --num_envs 64 \
            --num_frames 100 \
            --benchmark_formatter json \
            --output_path "hdc/benchmarks/franka_cloth/${physics}/${renderer}"
    done
done

# physx and newton_mjwarp_vbd are supported for franka_soft.
for physics in physx newton_mjwarp_vbd; do
    for renderer in ovrtx newton_renderer isaacsim_rtx; do
        echo -e "\033[1;36m==================================================================\033[0m"
        echo -e "\033[1;36m Benchmark: physics='${physics}', renderer='${renderer}' \033[0m"
        echo -e "\033[1;36m==================================================================\033[0m"

        # PhysX + OVRTX is not supported.
        if [[ "${physics}" == "physx" && "${renderer}" == "ovrtx" ]]; then
            echo -e "\033[1;31m Skipping unsupported backend combination... \033[0m"
            continue
        fi

        ./isaaclab.sh -p scripts/benchmarks/runtime.py \
            --task Isaac-Lift-Soft-Franka-Camera-Benchmark \
            --enable_cameras --headless \
            physics="${physics}" \
            renderer="${renderer}" \
            presets=rgb \
            --seed 42 \
            --num_envs 256 \
            --num_frames 100 \
            --benchmark_formatter json \
            --output_path "hdc/benchmarks/franka_soft/${physics}/${renderer}"
    done
done

Type of change

  • Test

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

Add benchmark-only camera variants for Franka cloth and soft-body
lifting across supported physics and renderer presets.

Reuse these configurations in rendering tests and exclude benchmark
tasks from generated training documentation.
@huidongc
huidongc requested a review from a team July 21, 2026 09:14
@github-actions github-actions Bot added isaac-lab Related to Isaac Lab team infrastructure labels Jul 21, 2026
@huidongc
huidongc marked this pull request as draft July 21, 2026 09:15
@greptile-apps

greptile-apps Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces benchmark-only camera variants (Isaac-Lift-Cloth-Franka-Camera-Benchmark and Isaac-Lift-Soft-Franka-Camera-Benchmark) for Franka deformable-lifting tasks, with one preset per rendered data type. It refactors the rendering test utilities to reuse these shared configs instead of constructing throwaway classes inline, and fixes environ_docs.py to exclude tasks whose IDs end with -Benchmark from generated training docs.

  • New benchmark package (isaaclab_tasks/benchmark/franka_soft/): adds FrankaClothCameraEnvCfg and FrankaSoftCameraEnvCfg as nested PresetCfg hierarchies covering 13 data types, registered via gym.register and auto-discovered by import_packages.
  • rendering_test_utils.py refactor: removes two ~75-line local factory functions and replaces them with imports of the new benchmark configs; data_type is now passed as a third preset token to _apply_overrides_to_env_cfg. The _skip_if_physics_preset_unsupported helper is extended to unwrap a top-level PresetCfg to its default before inspecting sim.physics.
  • environ_docs.py + tests: extends the benchmark-task filter to handle IDs that end with -Benchmark.

Confidence Score: 5/5

Safe to merge — benchmark-only configs and test infrastructure with no changes to production training paths.

All changes are additive: new benchmark env configs, test utilities refactoring, and a one-line docs-filter fix. The refactored _skip_if_physics_preset_unsupported correctly restores the Newton-only skip for cloth tasks under PhysX backends by unwrapping the top-level PresetCfg to its concrete default. The gym registration chain works via the existing import_packages mechanism. Unit tests cover registration, preset cascade, physics-preset parity with core variants, and replication-flag correctness.

No files require special attention.

Important Files Changed

Filename Overview
source/isaaclab_tasks/isaaclab_tasks/benchmark/franka_soft/franka_cloth_camera_env_cfg.py New file: defines FrankaClothCameraEnvCfg as a two-level PresetCfg (data-type outer, physics via sim.physics inner). scene override carries a type annotation; tiled_camera uses FrankaTiledCameraCfg (PresetCfg) resolved later via _apply_overrides_to_env_cfg.
source/isaaclab_tasks/isaaclab_tasks/benchmark/franka_soft/franka_soft_camera_env_cfg.py New file: FrankaSoftCameraEnvCfg with data-type outer preset and FrankaSoftCameraSceneCfg (physics scene preset) for inner resolution. physx correctly sets replicate_physics=False; preset set matches core FrankaSoftSceneCfg.
source/isaaclab_tasks/isaaclab_tasks/benchmark/franka_soft/franka_camera_cfg.py New file: FrankaTiledCameraCfg (PresetCfg) and camera_observations_cfg factory; clean, all 13 data types defined.
source/isaaclab_tasks/test/rendering_test_utils.py Removes ~150 lines of duplicated inline factory code; _skip_if_physics_preset_unsupported now unwraps top-level PresetCfg to its default before checking sim.physics, restoring Newton-only skip for cloth under PhysX backends.
source/isaaclab_tasks/test/benchmark/test_franka_camera_benchmark.py New test file: 5 unit tests covering registration, cfg loading, data-type cascade, physics preset parity with core variants, and physx/Newton replication flags.
tools/environ_docs.py One-line fix: adds task_id.endswith("-Benchmark") check so new tasks without a trailing segment are excluded from training docs.
tools/test/test_environ_docs.py Adds assertions for the two new benchmark task IDs in the is_training_task filter test.

Reviews (3): Last reviewed commit: "Code review feedbacks" | Re-trigger Greptile

Comment on lines +1490 to 1493
env_cfg = FrankaClothCameraEnvCfg()

physics_preset_name = _physics_preset_name_deformable(physics_backend)
_skip_if_physics_preset_unsupported(env_cfg, physics_preset_name)

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.

P1 _skip_if_physics_preset_unsupported is now a no-op for the new benchmark config

_skip_if_physics_preset_unsupported accesses env_cfg.sim.physics. FrankaClothCameraEnvCfg is a PresetCfg whose top-level attributes are data-type variants, not an env config, so getattr(env_cfg, "sim", None) returns None and the function returns immediately without checking anything.

Before this PR the helper received a concrete FrankaClothEnvCfg subclass whose sim.physics was franka_cloth_env_cfg.PhysicsCfg (Newton-only). For physics_backend="physx" or "ovphysx" that preset is absent, so the check issued a clean pytest.skip. Both PHYSICS_RENDERER_AOV_COMBINATIONS and KITLESS_PHYSICS_RENDERER_AOV_COMBINATIONS include those backends, so cloth tests previously skipped them. After this change the skip never fires: the preset string physx or ovphysx is passed to _apply_overrides_to_env_cfg, which will either error during resolution or silently fall back to the Newton default, making the test either crash or run with the wrong physics backend.

class BaseFrankaClothCameraEnvCfg(FrankaClothEnvCfg):
"""Camera variant of the Franka cloth lift environment."""

scene = FrankaClothCameraSceneCfg(num_envs=4, env_spacing=3.0, replicate_physics=True)

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.

P1 Missing type annotation on the scene field override, inconsistent with BaseFrankaSoftCameraEnvCfg (which writes scene: FrankaSoftCameraSceneCfg = ...) and with every other field override in the codebase. Python's dataclass machinery — and by extension Isaac Lab's configclass — only treats an assignment as a field override when a type annotation is present; without it the line is a plain class variable that does not replace the parent's scene default. If configclass follows standard dataclass semantics the child will silently keep FrankaClothSceneCfg(num_envs=128, …) (the parent's default) and tiled_camera will never be registered in the scene.

Suggested change
scene = FrankaClothCameraSceneCfg(num_envs=4, env_spacing=3.0, replicate_physics=True)
scene: FrankaClothCameraSceneCfg = FrankaClothCameraSceneCfg(num_envs=4, env_spacing=3.0, replicate_physics=True)

@huidongc
huidongc marked this pull request as ready for review July 21, 2026 10:03
@huidongc

Copy link
Copy Markdown
Collaborator Author

@greptile-apps

@AntoineRichard

AntoineRichard commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

Why do we need benchmark specific environments? I don't see the benefit of adding these.

See also #6564 it gives you a python API to benchmark environments. Feel free to approve it and its sibling PR which it depends on: #6474

@AntoineRichard AntoineRichard left a comment

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.

I don't see the benefit of this vs overriding things through the CLI of the benchmark command.

@AntoineRichard

Copy link
Copy Markdown
Collaborator

Closing this so @mmichelis can refactor this properly into his contrib task.

@huidongc
huidongc deleted the franka-envs-for-benchmarking branch July 21, 2026 12:44
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.

2 participants