Skip to content

Commit

Permalink
Merge branch 'toni/fix_gymnasium_unwrapped_warning' into toni/test_en…
Browse files Browse the repository at this point in the history
…v_wrappers
  • Loading branch information
Toni-SM committed Aug 4, 2024
2 parents 15cac8f + 80169ce commit a22d843
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions skrl/envs/wrappers/torch/isaaclab_envs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Tuple
from typing import Any, Tuple, Union

import gymnasium

Expand All @@ -21,13 +21,17 @@ def __init__(self, env: Any) -> None:
self._info = {}

@property
def state_space(self) -> gymnasium.Space:
def state_space(self) -> Union[gymnasium.Space, None]:
"""State space
"""
try:
return self._unwrapped.single_observation_space["critic"]
except:
except KeyError:
pass
try:
return self._unwrapped.state_space
except AttributeError:
return None

@property
def observation_space(self) -> gymnasium.Space:
Expand Down

0 comments on commit a22d843

Please sign in to comment.