Skip to content

[Bug Report] DomeLight instances share one DomeLightCfg via a mutable default argument #1044

Description

@kiniavinash

Describe the bug

DomeLight.__init__ uses the class-level default_spawner_cfg object as its spawner_cfg default argument:

# isaaclab_arena/assets/object_library.py:458,468
default_spawner_cfg = sim_utils.DomeLightCfg(color=(0.75, 0.75, 0.75), intensity=500.0)

def __init__(
    self,
    ...
    spawner_cfg: sim_utils.DomeLightCfg = default_spawner_cfg,

Object.__init__ then stores it by reference without copying (isaaclab_arena/assets/object.py:55, self.spawner_cfg = spawner_cfg). Since set_intensity, set_color, set_color_temperature and add_hdr mutate self.spawner_cfg in place (object_library.py:415, 422, 433-434, and in add_hdr), every DomeLight constructed without an explicit spawner_cfg shares one config object.

Consequences within a single process:

  • Adjusting the light in one environment silently changes it in every other environment that used the default.
  • The mutation persists into the class attribute, so lights constructed later start from the mutated value rather than the documented default of 500.
  • LightIntensityVariation / LightColorVariation / HDRImageVariation operate through these same setters, so variation sweeps leak across environments too.

This is silent — nothing raises, the light is simply the wrong brightness or colour. It matters most for multi-environment processes such as test_all_environments.py and experiment_runner, and for any workflow that tunes lighting per environment.

The same pattern is worth checking on the sibling light classes (DirectionalLight and others deriving from LightBase), which follow the same default_spawner_cfg idiom.

Steps to reproduce

from isaacsim import SimulationApp
app = SimulationApp({"headless": True})

from isaaclab_arena.assets.object_library import DomeLight

a = DomeLight()
b = DomeLight()

print("same cfg object:", a.spawner_cfg is b.spawner_cfg)
print("same as class default:", a.spawner_cfg is DomeLight.default_spawner_cfg)

a.set_intensity(385.0)

print("a.intensity =", a.spawner_cfg.intensity)
print("b.intensity =", b.spawner_cfg.intensity)
print("DomeLight.default_spawner_cfg.intensity =", DomeLight.default_spawner_cfg.intensity)
print("freshly constructed c.intensity =", DomeLight().spawner_cfg.intensity)

app.close()

Output:

same cfg object: True
same as class default: True
a.intensity = 385.0
b.intensity = 385.0
DomeLight.default_spawner_cfg.intensity = 385.0
freshly constructed c.intensity = 385.0

Expected: b and the class default stay at 500.0, and only a becomes 385.0.

System Info

  • Arena Release: main at 094a69b (v0.2.x)
  • Isaac Sim 6.0 / Isaac Lab 3.0 Beta, container image isaaclab_arena:latest

Additional context

The straightforward fix is to default spawner_cfg to None and copy when falling back:

spawner_cfg: sim_utils.DomeLightCfg | None = None,
...
super().__init__(..., spawner_cfg=spawner_cfg if spawner_cfg is not None else self.default_spawner_cfg.copy())

Copying a caller-supplied cfg as well would also stop two assets constructed from one shared cfg object from aliasing, though that is a broader change to Object.

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Acceptance Criteria

  • Two DomeLight instances constructed without an explicit spawner_cfg do not share a config object, and mutating one does not affect the other or the class attribute.
  • The same holds for the other LightBase subclasses using the default_spawner_cfg idiom.
  • A regression test covers the isolation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions