Add emissive light mode to randomize_indirect_lighting#274
Merged
Conversation
Extend `randomize_indirect_lighting` with a mutually exclusive emissive light mode alongside the existing HDR mode. **HDR mode** (unchanged): provide `path` to a folder of `.hdr` files; a random file is selected each call via `set_indirect_lighting`. **Emissive mode** (new): provide `emissive_color_range` and/or `emissive_intensity_range`; values are sampled uniformly each call via `set_emission_light`. Configuring both modes simultaneously raises a `ValueError` at init. Neither mode configured also raises a `ValueError`. Changes: - `randomize_indirect_lighting` functor rewritten to enforce mutual exclusivity with clear error messages - 11 unit tests added to `test_event_functors.py` covering init validation, HDR mode behaviour, and emissive mode behaviour - `MockSim` extended with `set_indirect_lighting` / `set_emission_light` stubs for testing - `event_functors.md` updated to document both modes with JSON examples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR extends
randomize_indirect_lightingto support a new emissive light mode that is mutually exclusive with the existing HDR environment-map mode.The functor now operates in one of two modes, enforced at initialisation:
path→ a random.hdrfile is selected each call viaset_indirect_lighting.emissive_color_rangeand/oremissive_intensity_range→ color and intensity are sampled uniformly each call viaset_emission_light.Configuring both modes simultaneously, or neither, raises a
ValueErrorwith a descriptive message.Type of change
Changes
embodichain/lab/gym/envs/managers/randomization/visual.py—randomize_indirect_lightingrewritten with mutual-exclusivity enforcement; HDR mode returns early so emissive code never runs, and vice-versa.tests/gym/envs/managers/test_event_functors.py— 11 new unit tests inTestRandomizeIndirectLightingcovering init validation, HDR mode, and emissive mode;MockSimextended withset_indirect_lighting/set_emission_lightstubs.docs/source/overview/gym/event_functors.md— updatedrandomize_indirect_lightingentry to document both modes with JSON config examples.Checklist
black .command to format the code base.🤖 Generated with Claude Code