Skip to content

[Bug Report] Sb3VecEnvWrapper overwrites action_space #609

@llinauer

Description

@llinauer

If you are submitting a bug report, please fill in the following details and use the tag [bug].

Describe the bug

The Sb3VecEnvWrapper (defined in

) calls the is_bounded method of the action_space of the underlying environment and checks if the return is not "both".
However, the return value of the is_bounded method (defined here https://github.com/Farama-Foundation/Gymnasium/blob/e2c89a1896cc9f575abe5f1b3c799b6a718364af/gymnasium/spaces/box.py#L320, version 0.29.0) is boolean and this conditional always evaluates to True. This causes the action_space to be overwritten and becoming a Box(-100.0, 100.0).

Rather, "both" should be the argument of is_bounded and it should be checked if the return value is not True.

Steps to reproduce

Please try to provide a minimal example to reproduce the bug. Error messages and stack traces are also helpful.

Minimal example:

import argparse
from omni.isaac.lab.app import AppLauncher

app_launcher = AppLauncher(argparse.Namespace())
simulation_app = app_launcher.app

import gymnasium as gym
import omni.isaac.lab_tasks  # noqa: F401
from omni.isaac.lab_tasks.utils import parse_env_cfg
from omni.isaac.lab_tasks.utils.wrappers.sb3 import Sb3VecEnvWrapper

env_cfg = parse_env_cfg("Isaac-Cartpole-Direct-v0", use_gpu=False, num_envs=1, use_fabric=True)
env = gym.make("Isaac-Cartpole-Direct-v0", cfg=env_cfg, render_mode="rgb_array")
env.action_space = gym.spaces.Box(low=-1, high=1, shape=(1,))
print(env.action_space)
env = Sb3VecEnvWrapper(env)
print(env.action_space)

System Info

Describe the characteristic of your environment:

  • Commit: d06b1f9
  • Isaac Sim Version: 4.0.0
  • OS: Ubuntu 22.04
  • GPU: GeForce RTX 3050
  • CUDA: 12.4
  • GPU Driver: 550.90.07

Additional context

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

Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.

  • The action_space is not overwritten by Sb3VecEnvWrapper anymore

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions