From 049c0b9bcac93487ab3fdb7947ec5b0f1dc7ec64 Mon Sep 17 00:00:00 2001 From: Ruo-Ping Dong Date: Mon, 24 May 2021 15:31:12 -0700 Subject: [PATCH 1/3] add env.render() to limitations --- gym-unity/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/gym-unity/README.md b/gym-unity/README.md index d963d59f73..71ffea855d 100755 --- a/gym-unity/README.md +++ b/gym-unity/README.md @@ -67,6 +67,7 @@ The returned environment `env` will function as a gym. be accessed from the `info` provided by `env.step(action)`. - Stacked vector observations are not supported. - Environment registration for use with `gym.make()` is currently not supported. +- Display rendering is not supported. Calling `env.render()` might not work as expected in display. ## Running OpenAI Baselines Algorithms From 4b06289d7b072789ca76ecbdfc6cd783642a2e8f Mon Sep 17 00:00:00 2001 From: Ruo-Ping Dong Date: Mon, 24 May 2021 17:14:29 -0700 Subject: [PATCH 2/3] add doc string --- gym-unity/README.md | 3 ++- gym-unity/gym_unity/envs/__init__.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gym-unity/README.md b/gym-unity/README.md index 71ffea855d..f664c16e46 100755 --- a/gym-unity/README.md +++ b/gym-unity/README.md @@ -67,7 +67,8 @@ The returned environment `env` will function as a gym. be accessed from the `info` provided by `env.step(action)`. - Stacked vector observations are not supported. - Environment registration for use with `gym.make()` is currently not supported. -- Display rendering is not supported. Calling `env.render()` might not work as expected in display. +- Calling env.render() will not render a new frame of the environment. It will + return the latest visual observation if using visual observations. ## Running OpenAI Baselines Algorithms diff --git a/gym-unity/gym_unity/envs/__init__.py b/gym-unity/gym_unity/envs/__init__.py index 0f70712947..f7699479e5 100644 --- a/gym-unity/gym_unity/envs/__init__.py +++ b/gym-unity/gym_unity/envs/__init__.py @@ -278,6 +278,9 @@ def _get_vec_obs_size(self) -> int: return result def render(self, mode="rgb_array"): + """Return the latest visual observations. + Note that it will not render a new frame of the environment. + """ return self.visual_obs def close(self) -> None: From 2c0dfb9af4f774a7c2cb59414ccc15a6feeb6ee0 Mon Sep 17 00:00:00 2001 From: Ruo-Ping Dong Date: Wed, 26 May 2021 10:56:54 -0700 Subject: [PATCH 3/3] Update gym-unity/gym_unity/envs/__init__.py Co-authored-by: Vincent-Pierre BERGES --- gym-unity/gym_unity/envs/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gym-unity/gym_unity/envs/__init__.py b/gym-unity/gym_unity/envs/__init__.py index f7699479e5..322d83659b 100644 --- a/gym-unity/gym_unity/envs/__init__.py +++ b/gym-unity/gym_unity/envs/__init__.py @@ -278,7 +278,8 @@ def _get_vec_obs_size(self) -> int: return result def render(self, mode="rgb_array"): - """Return the latest visual observations. + """ + Return the latest visual observations. Note that it will not render a new frame of the environment. """ return self.visual_obs