예제 #1
0
 def verify_reset_and_step(domain, task):
     env = RobosuiteAdapter(domain=domain,
                            task=task,
                            has_renderer=False,
                            has_offscreen_renderer=False,
                            use_camera_obs=False)
     env.reset()
     env.step(env.action_space.sample())
예제 #2
0
 def create_adapter(self, domain='Sawyer', task='Lift', *args, **kwargs):
     return RobosuiteAdapter(domain,
                             task,
                             *args,
                             **kwargs,
                             has_renderer=False,
                             has_offscreen_renderer=False,
                             use_camera_obs=False)
예제 #3
0
 def test_rescale_observation_raises_exception(self):
     environment_kwargs = {
         'domain': 'Sawyer',
         'task': 'Lift',
         'rescale_observation_range': (-1.0, 1.0),
     }
     with pytest.raises(NotImplementedError,
                        match=r"Observation rescaling .*"):
         environment = RobosuiteAdapter(**environment_kwargs)
예제 #4
0
    def test_environment_kwargs(self):
        env_kwargs = {
            "has_renderer": False,
            "has_offscreen_renderer": False,
            "use_camera_obs": False,
            "control_freq": 10,
            "horizon": 1000
        }

        env = RobosuiteAdapter(domain='Sawyer', task='Lift', **env_kwargs)

        observation1, reward, done, info = env.step(env.action_space.sample())

        self.assertAlmostEqual(reward, 0.0)

        for key, expected_value in env_kwargs.items():
            actual_value = getattr(env.unwrapped, key)
            self.assertEqual(actual_value, expected_value)
예제 #5
0
    def test_fails_with_unnormalized_action_spec(self):
        from robosuite.environments.sawyer_lift import SawyerLift

        class UnnormalizedEnv(SawyerLift):
            @property
            def dof(self):
                return 5

            @property
            def action_spec(self):
                low, high = np.ones(self.dof) * -2.0, np.ones(self.dof) * 2.0
                return low, high

        env = UnnormalizedEnv(has_renderer=False,
                              has_offscreen_renderer=False,
                              use_camera_obs=False)
        with self.assertRaises(AssertionError):
            adapter = RobosuiteAdapter(domain=None, task=None, env=env)