Ejemplo n.º 1
0
    def test_reset_world_seed_setting(self):
        self._world_name = self._connection.send(
            dm_env_rpc_pb2.CreateWorldRequest(
                settings={'seed': tensor_utils.pack_tensor(1234)})).world_name
        self._connection.send(
            dm_env_rpc_pb2.JoinWorldRequest(world_name=self._world_name))

        step_response = self._connection.send(dm_env_rpc_pb2.StepRequest())
        self._connection.send(
            dm_env_rpc_pb2.ResetWorldRequest(
                world_name=self._world_name,
                settings={'seed': tensor_utils.pack_tensor(1234)}))
        self.assertEqual(step_response,
                         self._connection.send(dm_env_rpc_pb2.StepRequest()))
Ejemplo n.º 2
0
 def test_cannot_reset_world_when_not_joined(self):
     with self.assertRaises(error.DmEnvRpcError):
         self._connection.send(dm_env_rpc_pb2.ResetWorldRequest())
Ejemplo n.º 3
0
 def test_can_reset_world_when_joined(self):
     self._connection.send(
         dm_env_rpc_pb2.JoinWorldRequest(world_name=self._world_name))
     self._connection.send(dm_env_rpc_pb2.ResetWorldRequest())
Ejemplo n.º 4
0
 def reset_world(self, world_name):
     """Resets the world."""
     self.connection.send(
         dm_env_rpc_pb2.ResetWorldRequest(
             world_name=world_name,
             settings=self.required_reset_world_settings))