Skip to content

Commit

Permalink
Update Omniverse Isaac Gym wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni-SM committed Aug 9, 2024
1 parent 355c2cd commit abc92ef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions skrl/envs/wrappers/torch/omniverse_isaacgym_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, env: Any) -> None:
super().__init__(env)

self._reset_once = True
self._obs_dict = None
self._observations = None

def run(self, trainer: Optional["omni.isaac.gym.vec_env.vec_env_mt.TrainerMT"] = None) -> None:
"""Run the simulation in the main thread
Expand All @@ -36,9 +36,9 @@ def step(self, actions: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch
:return: Observation, reward, terminated, truncated, info
:rtype: tuple of torch.Tensor and any other info
"""
self._obs_dict, reward, terminated, info = self._env.step(actions)
self._observations, reward, terminated, info = self._env.step(actions)
truncated = info["time_outs"] if "time_outs" in info else torch.zeros_like(terminated)
return self._obs_dict["obs"], reward.view(-1, 1), terminated.view(-1, 1), truncated.view(-1, 1), info
return self._observations["obs"], reward.view(-1, 1), terminated.view(-1, 1), truncated.view(-1, 1), info

def reset(self) -> Tuple[torch.Tensor, Any]:
"""Reset the environment
Expand All @@ -47,9 +47,9 @@ def reset(self) -> Tuple[torch.Tensor, Any]:
:rtype: torch.Tensor and any other info
"""
if self._reset_once:
self._obs_dict = self._env.reset()
self._observations = self._env.reset()
self._reset_once = False
return self._obs_dict["obs"], {}
return self._observations["obs"], {}

def render(self, *args, **kwargs) -> None:
"""Render the environment
Expand Down

0 comments on commit abc92ef

Please sign in to comment.