Skip to content

Commit

Permalink
Remove Robotics environments from Gym (#2516)
Browse files Browse the repository at this point in the history
* Remove registration of Robotics envs

* Remove Robotics environments

* Update setup.py

* Update unit tests

* Remove unused GoalEnv class
  • Loading branch information
seungjaeryanlee authored Dec 21, 2021
1 parent 51ffa07 commit 616b071
Show file tree
Hide file tree
Showing 80 changed files with 3 additions and 4,004 deletions.
1 change: 0 additions & 1 deletion gym/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from gym.core import (
Env,
GoalEnv,
Wrapper,
ObservationWrapper,
ActionWrapper,
Expand Down
46 changes: 0 additions & 46 deletions gym/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,52 +176,6 @@ def __exit__(self, *args):
return False


class GoalEnv(Env):
"""A goal-based environment. It functions just as any regular OpenAI Gym environment but it
imposes a required structure on the observation_space. More concretely, the observation
space is required to contain at least three elements, namely `observation`, `desired_goal`, and
`achieved_goal`. Here, `desired_goal` specifies the goal that the agent should attempt to achieve.
`achieved_goal` is the goal that it currently achieved instead. `observation` contains the
actual observations of the environment as per usual.
"""

def reset(self, seed: Optional[int] = None):
super().reset(seed=seed)
# Enforce that each GoalEnv uses a Goal-compatible observation space.
if not isinstance(self.observation_space, gym.spaces.Dict):
raise error.Error(
"GoalEnv requires an observation space of type gym.spaces.Dict"
)
for key in ["observation", "achieved_goal", "desired_goal"]:
if key not in self.observation_space.spaces:
raise error.Error(
'GoalEnv requires the "{}" key to be part of the observation dictionary.'.format(
key
)
)

@abstractmethod
def compute_reward(self, achieved_goal, desired_goal, info):
"""Compute the step reward. This externalizes the reward function and makes
it dependent on a desired goal and the one that was achieved. If you wish to include
additional rewards that are independent of the goal, you can include the necessary values
to derive it in 'info' and compute it accordingly.
Args:
achieved_goal (object): the goal that was achieved during execution
desired_goal (object): the desired goal that we asked the agent to attempt to achieve
info (dict): an info dictionary with additional information
Returns:
float: The reward that corresponds to the provided achieved goal w.r.t. to the desired
goal. Note that the following should always hold true:
ob, reward, done, info = env.step()
assert reward == env.compute_reward(ob['achieved_goal'], ob['desired_goal'], info)
"""
raise NotImplementedError


class Wrapper(Env):
"""Wraps the environment to allow a modular transformation.
Expand Down
Loading

0 comments on commit 616b071

Please sign in to comment.