embodichain.lab.gym.utils#
Registration System#
- class embodichain.lab.gym.utils.registration.EnvSpec[source]#
Bases:
objectMethods:
__init__(uid, cls[, max_episode_steps, ...])A specification for a Embodied environment.
Attributes:
Return a gym EnvSpec for this env
- __init__(uid, cls, max_episode_steps=None, default_kwargs=None)[source]#
A specification for a Embodied environment.
- property gym_spec#
Return a gym EnvSpec for this env
- embodichain.lab.gym.utils.registration.register(name, cls, max_episode_steps=None, default_kwargs=None)[source]#
Register a Embodied environment.
- embodichain.lab.gym.utils.registration.register_env(uid, max_episode_steps=None, override=False, **kwargs)[source]#
A decorator to register Embodied environments.
- Parameters:
uid (str) – unique id of the environment.
max_episode_steps (int) – maximum number of steps in an episode.
override (bool) – whether to override the environment if it is already registered.
Notes
max_episode_steps is processed differently from other keyword arguments in gym. gym.make wraps the env with gym.wrappers.TimeLimit to limit the maximum number of steps.
gym.EnvSpec uses kwargs instead of **kwargs!
- embodichain.lab.gym.utils.registration.make(env_id, **kwargs)[source]#
Instantiate a Embodied environment.
- Parameters:
env_id (str) – Environment ID.
as_gym (bool, optional) – Add TimeLimit wrapper as gym.
**kwargs – Keyword arguments to pass to the environment.
- class embodichain.lab.gym.utils.registration.TimeLimitWrapper[source]#
Bases:
Wrapperlike the standard gymnasium timelimit wrapper but fixes truncated variable to be a batched array
Methods:
__init__(env, max_episode_steps)Wraps an environment to allow a modular transformation of the
step()andreset()methods.step(action)Uses the
step()of theenvthat can be overwritten to change the returned data.