OmniIsaacGymEnv porevious version (Isaac Sim 2022.2.0)

Hi @toni.sm , I’m using OmniIsaacGymEnv well.

I was using OmniIsaacGymEnv in Isaac Sim 2022.2.0 just fine.

However, after updating to Isaac Sim 2022.2.1, the following error occurs.

[skrl:INFO] Seed: 42
Traceback (most recent call last):
  File "reaching_iiwa_omniverse_isaacgym_skrl_train.py", line 60, in <module>
    env = get_env_instance(headless=headless)
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/skrl/utils/omniverse_isaacgym_utils.py", line 275, in get_env_instance
    return _OmniIsaacGymVecEnv(headless=headless, enable_livestream=enable_livestream, enable_viewport=enable_viewport)
TypeError: __init__() got an unexpected keyword argument 'enable_livestream'
There was an error running python

I want to use OmniIsaacGymEnv in IsaacSim 2022.2.0, but only 2022.2.1 version exists on the official site or github.

How can I solve this problem ?

Thank you !

Hi @swimpark

It’s my fault, when I updated skrl to version 0.10.2 for OIGE I simply dropped compatibility with Isaac Sim 2022.2.0 and earlier.

Please, identify the skrl path (~/.local/share/ov/pkg/isaac_sim-2022.2.0/python.sh -m pip show skrl) and replace the next lines in skrl/utils/omniverse_isaacgym_utils.py (starting in line 272).

    if multi_threaded:
        return _OmniIsaacGymVecEnvMT(headless=headless, enable_livestream=enable_livestream, enable_viewport=enable_viewport)
    else:
        return _OmniIsaacGymVecEnv(headless=headless, enable_livestream=enable_livestream, enable_viewport=enable_viewport)

with

    if multi_threaded:
        try:
            return _OmniIsaacGymVecEnvMT(headless=headless, enable_livestream=enable_livestream, enable_viewport=enable_viewport)
        except TypeError:
            return _OmniIsaacGymVecEnvMT(headless=headless)  # Isaac Sim 2022.2.0 and earlier
    else:
        try:
            return _OmniIsaacGymVecEnv(headless=headless, enable_livestream=enable_livestream, enable_viewport=enable_viewport)
        except TypeError:
            return _OmniIsaacGymVecEnv(headless=headless)  # Isaac Sim 2022.2.0 and earlier

I will add the change for the next release

1 Like

Thank you for your rapid reply, @toni.sm.

Additionally, I just downloaded [ppo_anymal_terrian.py] at [/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/OmniIsaacGymEnvs/omniisaacgymenvs], and launch the python file with IsaacSim python shell (PYTHON_PATH ppo_anymal_terrian.py).

image

Howerver, the error occurs like below.

Traceback (most recent call last):
  File "ppo_anymal_terrain.py", line 59, in <module>
    env = load_omniverse_isaacgym_env(task_name="AnymalTerrain")
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/skrl/envs/torch/loaders.py", line 430, in load_omniverse_isaacgym_env
    if config.multi_gpu:
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 357, in __getattr__
    self._format_and_raise(key=key, value=None, cause=e)
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/base.py", line 196, in _format_and_raise
    type_override=type_override,
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/_utils.py", line 741, in format_and_raise
    _raise(ex, cause)
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/_utils.py", line 719, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set end OC_CAUSE=1 for full backtrace
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 351, in __getattr__
    return self._get_impl(key=key, default_value=_DEFAULT_MARKER_)
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 438, in _get_impl
    node = self._get_node(key=key, throw_on_missing_key=True)
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 465, in _get_node
    self._validate_get(key)
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 167, in _validate_get
    key=key, value=value, cause=ConfigAttributeError(msg)
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/base.py", line 196, in _format_and_raise
    type_override=type_override,
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/_utils.py", line 821, in format_and_raise
    _raise(ex, cause)
  File "/home/freethinker/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/python/lib/python3.7/site-packages/omegaconf/_utils.py", line 719, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set end OC_CAUSE=1 for full backtrace
omegaconf.errors.ConfigAttributeError: Key 'multi_gpu' is not in struct
    full_key: multi_gpu
    object_type=dict
There was an error running python

Could you let me know the part that I modify.

Thank you !

Hi @swimpark

This error comes form using an old OIGE version.

Please, identify the skrl path (~/.local/share/ov/pkg/isaac_sim-2022.2.0/python.sh -m pip show skrl) and replace the next lines in skrl/envs/torch/loaders.py (from line 430 to 450).

    if config.multi_gpu:
        rank = int(os.getenv("LOCAL_RANK", "0"))
        config.device_id = rank
        config.rl_device = f"cuda:{rank}"
    enable_viewport = "enable_cameras" in config.task.sim and config.task.sim.enable_cameras

    if multi_threaded:
        env = _OmniIsaacGymVecEnvMT(headless=config.headless,
                                    sim_device=config.device_id,
                                    enable_livestream=config.enable_livestream,
                                    enable_viewport=enable_viewport)
        task = initialize_task(cfg, env, init_sim=False)
        env.initialize(env.action_queue, env.data_queue, timeout=timeout)
    else:
        env = _OmniIsaacGymVecEnv(headless=config.headless,
                                  sim_device=config.device_id,
                                  enable_livestream=config.enable_livestream,
                                  enable_viewport=enable_viewport)
        task = initialize_task(cfg, env, init_sim=True)

    return env

with

    try:
        if config.multi_gpu:
            rank = int(os.getenv("LOCAL_RANK", "0"))
            config.device_id = rank
            config.rl_device = f"cuda:{rank}"
    except:
        pass
    enable_viewport = "enable_cameras" in config.task.sim and config.task.sim.enable_cameras

    if multi_threaded:
        try:
            env = _OmniIsaacGymVecEnvMT(headless=config.headless,
                                        sim_device=config.device_id,
                                        enable_livestream=config.enable_livestream,
                                        enable_viewport=enable_viewport)
        except:
            env = _OmniIsaacGymVecEnvMT(headless=config.headless)  # Isaac Sim 2022.2.0 and earlier
        task = initialize_task(cfg, env, init_sim=False)
        env.initialize(env.action_queue, env.data_queue, timeout=timeout)
    else:
        try:
            env = _OmniIsaacGymVecEnv(headless=config.headless,
                                      sim_device=config.device_id,
                                      enable_livestream=config.enable_livestream,
                                      enable_viewport=enable_viewport)
        except:
            env = _OmniIsaacGymVecEnv(headless=config.headless)  # Isaac Sim 2022.2.0 and earlier
        task = initialize_task(cfg, env, init_sim=True)

    return env

It also include some other changes like previous post.
I will add these changes for the next release too.

Thanks for reporting the issue.

Thanks for the reply, @toni.sm.

Let me ask you one last question.

I know that there are two ways to do reinforcement learning in Omniverse Isaac Sim as follows.

  1. PYTHON_PATH scripts/rlgames_train.py task=Cartpole in isaac sim example
    or
  2. PYTHON_PATH ppo_anymal_terrain.py downloaded from skrl homepage.

I did not see a difference between the two learning methods.

When I read the description of ‘Getting Started’ of skrl, I understood that skrl is an API that integrates various reinforcement learning environments (Deepmind, Nvidia, Gymnasium, etc…).

Then, is it true that there is virtually no big difference between the two learning methods mentioned above?

Also, I wonder what the big difference is between the learning methods of skrl and OmniIsaacGymEnv’s rlgames_train.py.

thank you.

Hi @swimpark

Both rl_games and skrl are libraries for doing RL tasks.

rl_games is the default integrated library in OIGE (there are the input scripts and the configuration/hyperparameters files).

Regarding the difference between the implementations, rl_games includes some features (I have adapted other rl_games features to the skrl API), for example: bound loss or execution of the learning rate scheduler at each leaning epoch (called legacy schedule type), which can achieve slightly higher performance.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.