embodichain.lab.gym.utils#

Registration System#

class embodichain.lab.gym.utils.registration.EnvSpec[source]#

Bases: object

Methods:

__init__(uid, cls[, max_episode_steps, ...])

A specification for a Embodied environment.

Attributes:

gym_spec

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: Wrapper

like 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() and reset() methods.

step(action)

Uses the step() of the env that can be overwritten to change the returned data.

__init__(env, max_episode_steps)[source]#

Wraps an environment to allow a modular transformation of the step() and reset() methods.

Parameters:

env (Env) – The environment to wrap

step(action)[source]#

Uses the step() of the env that can be overwritten to change the returned data.

Utility Modules#

Gymnasium Utilities#

Miscellaneous#