garage.envs.metaworld_set_task_env
¶
Environment that wraps a MetaWorld benchmark in the set_task interface.
- class MetaWorldSetTaskEnv(benchmark=None, kind=None, wrapper=None, add_env_onehot=False)¶
Bases:
garage._environment.Environment
Environment form of a MetaWorld benchmark.
This class is generally less efficient than using a TaskSampler, if that can be used instead, since each instance of this class internally caches a copy of each environment in the benchmark.
In order to sample tasks from this environment, a benchmark must be passed at construction time.
- Parameters
benchmark (metaworld.Benchmark or None) – The benchmark to wrap.
kind (str or None) – Whether to use test or train tasks.
wrapper (Callable[garage.Env, garage.Env] or None) – Wrapper to apply to env instances.
add_env_onehot (bool) – If true, a one-hot representing the current environment name will be added to the environments. Should only be used with multi-task benchmarks.
- Raises
ValueError – If kind is not ‘train’, ‘test’, or None. Also raisd if add_env_onehot is used on a metaworld meta learning (not multi-task) benchmark.
- property action_space¶
The action space specification.
- Type
akro.Space
- property observation_space¶
The observation space specification.
- Type
akro.Space
- sample_tasks(n_tasks)¶
Samples n_tasks tasks.
Part of the set_task environment protocol. To call this method, a benchmark must have been passed in at environment construction.
- set_task(task)¶
Set the task.
Part of the set_task environment protocol.
- step(action)¶
Step the wrapped env.
- Parameters
action (np.ndarray) – An action provided by the agent.
- Returns
The environment step resulting from the action.
- Return type
- reset()¶
Reset the wrapped env.
- Returns
- The first observation conforming to
observation_space.
- dict: The episode-level information.
Note that this is not part of env_info provided in step(). It contains information of he entire episode, which could be needed to determine the first action (e.g. in the case of goal-conditioned or MTRL.)
- Return type
numpy.ndarray
- render(mode)¶
Render the wrapped environment.
- visualize()¶
Creates a visualization of the wrapped environment.
- close()¶
Close the wrapped env.