From 2ba7315bdbb3ccb7a234323c42571b63bc7dc0e8 Mon Sep 17 00:00:00 2001 From: Melvin Laux Date: Mon, 27 May 2024 19:45:36 +0200 Subject: [PATCH] set correct values for tests --- tests/envs/test_floating_mia_grasp_env.py | 6 ++++-- tests/envs/test_floating_shadow_grasp_env.py | 8 +++----- tests/envs/test_ur10_shadow_grasp_env.py | 8 ++++---- tests/envs/test_ur5_mia_grasp_env.py | 12 ++++++++---- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/envs/test_floating_mia_grasp_env.py b/tests/envs/test_floating_mia_grasp_env.py index fbd8020..201e726 100644 --- a/tests/envs/test_floating_mia_grasp_env.py +++ b/tests/envs/test_floating_mia_grasp_env.py @@ -10,11 +10,13 @@ def env(): gui=False, verbose=False, horizon=10, - object_name="insole_on_conveyor_belt/back") + object_name="insole_on_conveyor_belt/back", + #observable_object_pos=True, + ) -action_space_dims_expected = 10 observation_space_dims_expected = 16 +action_space_dims_expected = 10 SEED = 42 diff --git a/tests/envs/test_floating_shadow_grasp_env.py b/tests/envs/test_floating_shadow_grasp_env.py index 2838946..3d5f3c3 100644 --- a/tests/envs/test_floating_shadow_grasp_env.py +++ b/tests/envs/test_floating_shadow_grasp_env.py @@ -1,8 +1,7 @@ import pytest from numpy.testing import assert_allclose -from deformable_gym.envs.floating_shadow_grasp_env import \ - FloatingShadowGraspEnv +from deformable_gym.envs.floating_shadow_grasp_env import (FloatingShadowGraspEnv) @pytest.fixture @@ -16,8 +15,8 @@ def env(): ) -observation_space_dims_expected = 28 -action_space_dims_expected = 32 +observation_space_dims_expected = 31 +action_space_dims_expected = 31 SEED = 42 @@ -35,7 +34,6 @@ def test_obs_space_dims(env: FloatingShadowGraspEnv): obs_space = env.observation_space assert obs_space.shape[0] == obs_space_dims_expected - def test_initial_sensor_info(env: FloatingShadowGraspEnv): sensor_readings = [] env.action_space.seed(SEED) diff --git a/tests/envs/test_ur10_shadow_grasp_env.py b/tests/envs/test_ur10_shadow_grasp_env.py index 3db9288..d3763cb 100644 --- a/tests/envs/test_ur10_shadow_grasp_env.py +++ b/tests/envs/test_ur10_shadow_grasp_env.py @@ -8,15 +8,15 @@ def env(): return UR10ShadowGraspEnv( gui=False, - verbose=True, + verbose=False, horizon=10, object_name="insole", - #observable_object_pos=True, + observable_object_pos=True, ) -observation_space_dims_expected = 28 -action_space_dims_expected = 32 +observation_space_dims_expected = 31 +action_space_dims_expected = 31 SEED = 42 diff --git a/tests/envs/test_ur5_mia_grasp_env.py b/tests/envs/test_ur5_mia_grasp_env.py index 1f94c34..de39fca 100644 --- a/tests/envs/test_ur5_mia_grasp_env.py +++ b/tests/envs/test_ur5_mia_grasp_env.py @@ -8,9 +8,10 @@ def env(): return UR5MiaGraspEnv( gui=False, - verbose=True, + verbose=False, horizon=10, object_name="insole", + #observable_object_pos=True, ) @@ -26,9 +27,12 @@ def test_action_space_dims(env): def test_obs_space_dims(env): if env._observable_object_pos: - assert env.observation_space.shape[0] == observation_space_dims_expected + 3 + obs_space_dims_expected = observation_space_dims_expected + 3 else: - assert env.observation_space.shape[0] == observation_space_dims_expected + obs_space_dims_expected = observation_space_dims_expected + + obs_space = env.observation_space + assert obs_space.shape[0] == obs_space_dims_expected def test_episode_reproducibility(): @@ -70,7 +74,7 @@ def test_eps_done(env): action = env.action_space.sample() obs, reward, terminated, truncated, info = env.step(action) - assert len(obs) == 16 + assert len(obs) == observation_space_dims_expected assert isinstance(reward, float) assert isinstance(terminated, bool) assert not terminated