Skip to content

Commit

Permalink
Isaac Lab wrapper's multi-agent state retrieval with gymnasium 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni-SM authored Jan 5, 2025
1 parent e49f98f commit a7f82b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Model state dictionary initialization for composite Gymnasium spaces in JAX
- Add missing `reduction` parameter to Gaussian model instantiator
- Optax's learning rate schedulers integration in JAX implementation
- Isaac Lab wrapper's multi-agent state retrieval with gymnasium 1.0

### Removed
- Remove OpenAI Gym (`gym`) from dependencies and source code. **skrl** continues to support gym environments,
Expand Down
5 changes: 4 additions & 1 deletion skrl/envs/wrappers/jax/isaaclab_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ def state(self) -> Union[np.ndarray, jax.Array, None]:
:return: State
:rtype: np.ndarray, jax.Array or None
"""
state = self._env.state()
try:
state = self._env.state()
except AttributeError: # 'OrderEnforcing' object has no attribute 'state'
state = self._unwrapped.state()
if state is not None:
state = flatten_tensorized_space(tensorize_space(next(iter(self.state_spaces.values())), state))
return _torch2jax(state, self._jax)
Expand Down
5 changes: 4 additions & 1 deletion skrl/envs/wrappers/torch/isaaclab_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ def state(self) -> torch.Tensor:
:return: State
:rtype: torch.Tensor
"""
state = self._env.state()
try:
state = self._env.state()
except AttributeError: # 'OrderEnforcing' object has no attribute 'state'
state = self._unwrapped.state()
if state is not None:
return flatten_tensorized_space(tensorize_space(next(iter(self.state_spaces.values())), state))
return state
Expand Down

0 comments on commit a7f82b2

Please sign in to comment.