Skip to content

Commit

Permalink
Add test for wrapping Isaac Gym preview environments in torch
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni-SM committed Aug 5, 2024
1 parent 9c2b8a8 commit e252c06
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions tests/torch/test_wrapper_isaaclab.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,40 +104,3 @@ def test_env(capsys: pytest.CaptureFixture, num_states):
assert isinstance(info, Mapping)

env.close()

# def test_vectorized_env(capsys: pytest.CaptureFixture):
# num_envs = 10
# action = torch.ones((num_envs, 1))

# # load wrap the environment
# original_env = gym.make_vec("Pendulum-v1", num_envs=num_envs)
# env = wrap_env(original_env, "gymnasium")
# assert isinstance(env, GymnasiumWrapper)

# # check properties
# assert env.state_space is None
# assert isinstance(env.observation_space, gym.Space) and env.observation_space.shape == (3,)
# assert isinstance(env.action_space, gym.Space) and env.action_space.shape == (1,)
# assert isinstance(env.num_envs, int) and env.num_envs == num_envs
# assert isinstance(env.num_agents, int) and env.num_agents == 1
# assert isinstance(env.device, torch.device)
# # check internal properties
# assert env._env is original_env
# assert env._unwrapped is original_env.unwrapped
# assert env._vectorized is True
# # check methods
# for _ in range(2):
# observation, info = env.reset()
# observation, info = env.reset() # edge case: vectorized environments are autoreset
# assert isinstance(observation, torch.Tensor) and observation.shape == torch.Size([num_envs, 3])
# assert isinstance(info, Mapping)
# for _ in range(3):
# observation, reward, terminated, truncated, info = env.step(action)
# env.render()
# assert isinstance(observation, torch.Tensor) and observation.shape == torch.Size([num_envs, 3])
# assert isinstance(reward, torch.Tensor) and reward.shape == torch.Size([num_envs, 1])
# assert isinstance(terminated, torch.Tensor) and terminated.shape == torch.Size([num_envs, 1])
# assert isinstance(truncated, torch.Tensor) and truncated.shape == torch.Size([num_envs, 1])
# assert isinstance(info, Mapping)

# env.close()

0 comments on commit e252c06

Please sign in to comment.