Skip to content

Align Arena with Isaac Lab: stop unwrapping env after gym.make()#455

Closed
cvolkcvolk wants to merge 5 commits intomainfrom
cvolk/refactor/no-unwrap-arena-env
Closed

Align Arena with Isaac Lab: stop unwrapping env after gym.make()#455
cvolkcvolk wants to merge 5 commits intomainfrom
cvolk/refactor/no-unwrap-arena-env

Conversation

@cvolkcvolk
Copy link
Collaborator

@cvolkcvolk cvolkcvolk commented Mar 2, 2026

Summary

  • Removes .unwrapped from make_registered_and_return_cfg and policy_runner.py so Arena aligns with how Isaac Lab itself handles environments
  • make_registered_and_return_cfg now returns the wrapped env from gym.make() directly, consistent with Isaac Lab's RL scripts (train.py, play.py) which keep the wrapped env and pass it to the RL runner
  • Utility functions and tests that need to reach past the gym API boundary to Isaac Lab-specific attributes (.scene, .cfg, .device, .termination_manager) now use env.unwrapped.X explicitly at each access site
  • Keeping the wrapped env allows gym wrappers (e.g. RecordVideo) to be composed on top cleanly, without special-casing in make_registered_and_return_cfg

Motivation

PR #445 (video recording support) required adding if render_mode is None: env = env.unwrapped to conditionally skip unwrapping — an awkward workaround caused by Arena's convention of always returning the base env. This refactor removes the root cause.

cvolkcvolk and others added 3 commits March 2, 2026 14:15
Isaac Lab keeps the wrapped gym env and uses env.unwrapped only as an
explicit accessor for Isaac Lab-specific attributes. Arena was always
calling .unwrapped at construction time, which conflicted with composing
gym wrappers (e.g. RecordVideo) on top. gymnasium's Wrapper.__getattr__
forwards attribute access to the base env, so callers are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Clemens Volk <cvolk@nvidia.com>
- Use env.unwrapped.cfg explicitly to access Isaac Lab-specific attributes,
  since gymnasium's OrderEnforcing wrapper does not forward all attributes
- Fix pbar UnboundLocalError when exception occurs before progress bar init
- Use env.unwrapped.seed() in set_seed for the same reason

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Clemens Volk <cvolk@nvidia.com>
@cvolkcvolk cvolkcvolk force-pushed the cvolk/refactor/no-unwrap-arena-env branch from 990d35f to 17624b0 Compare March 2, 2026 13:18
cvolkcvolk and others added 2 commits March 2, 2026 18:18
After the previous commit stopped unwrapping the env in make_registered(),
utility functions and tests that access IsaacLab-specific attributes
(scene, cfg, device, termination_manager) now need env.unwrapped to
reach past the gymnasium OrderEnforcing wrapper, which has no __getattr__
forwarding in gymnasium 1.2.1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…cate_asset, test_events

Four tests were still accessing IsaacLab-specific attributes (env.scene, env.device)
directly on the wrapped env returned by make_registered(). Add .unwrapped to each
access site.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant