Skip to content

Light intensity variation.#775

Merged
alexmillane merged 56 commits into
mainfrom
alex/feature/light_intensity_variation
Jun 11, 2026
Merged

Light intensity variation.#775
alexmillane merged 56 commits into
mainfrom
alex/feature/light_intensity_variation

Conversation

@alexmillane

Copy link
Copy Markdown
Collaborator

Summary

Add light intensity variation.

Detailed description

  • Modifies the light intensity at runtime.

Introduce the variation framework: a VariationBase with build-time and
run-time flavors, a SamplerBase abstraction with uniform and categorical
samplers, and two concrete variations -- HDR dome-light image selection
(build-time) and camera extrinsic decalibration (run-time).

Variations attach to any Asset (scene objects or embodiments) and are
collected by ArenaEnvBuilder, which applies build-time variations before
scene composition and folds run-time variations into the event manager
cfg. All variations default to disabled so existing envs are unchanged.

The variations package exposes its API lazily (PEP 562 __getattr__):
camera_decalibration pulls in torch and isaaclab.sensors, and importing
that pair before the SimulationApp launches corrupts USD's Python
bindings. Lazy exports keep importing the package -- or its lightweight
base/sampler submodules -- safe at module-load time (e.g. pytest
collection).

Signed-off-by: alex <amillane@nvidia.com>
- Rename camera_decalibration.py -> camera_decalibration_variation.py
- Drop package-level re-exports; import concrete classes from submodules
- Remove sampler/variation listener plumbing (deferred to a follow-up MR)
- Hoist a compulsory sampler_cfg field onto VariationBaseCfg and rename the
  per-variation sampler field to sampler_cfg
- Replace UniformSampler.event_shape with an abstract SamplerBase.shape_per_sample
- Drop the camera variation's unused mode field (all variations fire on reset)
- Move attribute docs onto each member and trim docstrings to one line

Signed-off-by: alex <amillane@nvidia.com>
Agents drove the container with bare `docker exec` (root), while users
attach via run_docker.sh as their host user (su $(id -un)). Root-run
commands left root-owned files in shared caches (/tmp/Assets, ~/.config)
that the host user could not read, breaking their later interactive runs.

Update AGENTS.md and the dev-container/run-tests skills to route every
in-container command through `su $(id -un) -c`, mirroring run_docker.sh.

Signed-off-by: alex <amillane@nvidia.com>
@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds LightIntensityVariation, a build-time variation that samples dome light intensity from a uniform distribution and applies it via a new set_intensity helper on DomeLight. The add_hdr method is also refactored to mutate the spawner config in-place rather than rebuilding it.

  • Adds LightIntensityVariation / LightIntensityVariationCfg, automatically attached to every DomeLight at construction, following the same BuildTimeVariationBase pattern as HDRImageVariation.
  • Adds DomeLight.set_intensity(intensity) and refactors add_hdr to mutate self.spawner_cfg in place; both methods call _init_object_cfg() to refresh the scene config.
  • Reduces default_spawner_cfg intensity from 3000.0 to 500.0 and adds a test_light_intensity_variation.py with enabled/disabled coverage, each running in a subprocess.

Confidence Score: 4/5

Safe to merge with the in-place mutation issue addressed; the test suite uses subprocess isolation so tests will pass, but the shared default config will be silently corrupted in any same-process multi-instance scenario.

The set_intensity method and the refactored add_hdr both mutate self.spawner_cfg directly. Because the default spawner_cfg parameter is backed by a single class-level object, those writes propagate to every future DomeLight() instance in the same process. The old add_hdr deliberately created a fresh DomeLightCfg to avoid exactly this, and that guard has been removed.

isaaclab_arena/assets/object_library.py — specifically the set_intensity method and the refactored add_hdr block around lines 508–523.

Important Files Changed

Filename Overview
isaaclab_arena/variations/light_intensity_variation.py New BuildTimeVariationBase that samples intensity from a uniform distribution and delegates to DomeLight.set_intensity; sampler indexing [0,0] is correct for the (1,1)-shaped output.
isaaclab_arena/assets/object_library.py Adds set_intensity and refactors add_hdr to mutate spawner_cfg in-place; both methods write through the shared class-level default_spawner_cfg when no explicit config is passed, silently corrupting defaults for future DomeLight() instances in the same process.
isaaclab_arena/tests/test_light_intensity_variation.py New test covering enabled and disabled variation paths; variation name 'intensity' matches the implementation and tests run in isolated subprocesses.

Reviews (3): Last reviewed commit: "Rename test." | Re-trigger Greptile

Comment thread isaaclab_arena/variations/light_intensity_variation.py
Comment thread isaaclab_arena/variations/light_intensity_variation.py
Comment thread isaaclab_arena/tests/test_dome_light_intensity_variation.py Outdated

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

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.

🤖 Isaac Lab Review Bot

Summary

This PR adds a build-time variation that samples and applies dome light intensity before environment composition. The implementation follows the existing HDRImageVariation pattern well, with a clean separation between the variation class, the DomeLight.set_intensity() helper, and the test. However, there is a name mismatch between the variation registration and the test lookup that will cause test failures, a stale docstring, and a debug print left in production code.

Design Assessment

Design is sound. The approach correctly mirrors the HDRImageVariation pattern — a BuildTimeVariationBase subclass with a reference to the light asset, sampling once at build time. The refactor of add_hdr to mutate in-place rather than reconstructing the entire DomeLightCfg is a good simplification. Adding set_intensity() as a public method on DomeLight is the right level of abstraction.

Findings

See inline comments for details.

Test Coverage

  • New code: Yes — dedicated test file covers both enabled and disabled paths
  • Gaps: Test will fail due to name mismatch (see Critical finding); once fixed, coverage is adequate
  • Quality: Good use of degenerate sampler range for deterministic assertions

CI Status

⏳ Pre-commit check is pending.

Verdict

Significant concerns

The variation name mismatch ("intensity" vs "dome_light_intensity") means the included tests cannot pass as-is, which is a blocking issue. The debug print() statement should also be removed before merge. Once these are addressed, the implementation is clean and follows established patterns well.


Update (d7888a3): All previous concerns have been addressed ✅

  • 🔴 Name mismatch — Fixed. Test now uses "intensity" consistently matching the variation's default name.
  • 🟡 Debug print() statement — Removed.
  • 🟡 Stale docstring — Simplified; misleading range text removed.
  • 🔵 Unused DEFAULT_INTENSITY constant — Removed.

No new issues found in the incremental changes. LGTM.

Comment thread isaaclab_arena/variations/light_intensity_variation.py
Comment thread isaaclab_arena/variations/light_intensity_variation.py
Comment thread isaaclab_arena/variations/light_intensity_variation.py
Comment thread isaaclab_arena/tests/test_light_intensity_variation.py

@cvolkcvolk cvolkcvolk 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.

Nice

@alexmillane alexmillane force-pushed the alex/feature/light_intensity_variation branch from d7888a3 to fa1349e Compare June 11, 2026 15:38
@alexmillane alexmillane changed the base branch from alex/feature/variation_hydra_config to main June 11, 2026 16:19
@alexmillane alexmillane merged commit 500ca6f into main Jun 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants