Pipeline

Helper methods to generate learning environment pipeline, consisting in an barebone environment inheriting from BaseJiminyEnv, wrapped together with any number of successive blocks as a unified environment, in Matlab Simulink fashion.

It enables to break down a complex control architectures in many submodules, making it easier to maintain and avoiding code duplications between usecases.

class gym_jiminy.common.pipeline.EnvConfig(**kwargs)[source]

Bases: dict

Environment class type.

Note

Both class type or fully qualified dotted path are supported.

env_class: Union[Type[gym_jiminy.common.envs.env_generic.BaseJiminyEnv], str]

Environment constructor default arguments.

This attribute can be omitted.

env_kwargs: Dict[str, Any]
class gym_jiminy.common.pipeline.BlockConfig(**kwargs)[source]

Bases: dict

Block class type. If specified, it must derive from BaseControllerBlock for controller blocks or BaseObserverBlock for observer blocks.

This attribute can be omitted. If so, then ‘block_kwargs’ must be omitted and ‘wrapper_class’ must be specified. Indeed, not all block are associated with a dedicated observer or controller object. It happens when the block is not doing any computation on its own but just transforming the action or observation, e.g. stacking observation frames.

Note

Both class type or fully qualified dotted path are supported.

block_class: Union[Type[gym_jiminy.common.bases.block_bases.BaseControllerBlock], Type[gym_jiminy.common.bases.block_bases.BaseObserverBlock], str]

Block constructor default arguments.

This attribute can be omitted.

block_kwargs: Dict[str, Any]

Wrapper class type.

This attribute can be omitted. If so, then ‘wrapper_kwargs’ must be omitted and ‘block_class’ must be specified. The latter will be used to infer the default wrapper type.

Note

Both class type or fully qualified dotted path are supported.

wrapper_class: Union[Type[gym_jiminy.common.bases.pipeline_bases.BasePipelineWrapper], str]

Wrapper constructor default arguments.

This attribute can be omitted.

wrapper_kwargs: Dict[str, Any]
gym_jiminy.common.pipeline.build_pipeline(env_config, blocks_config=())[source]

Wrap together an environment inheriting from BaseJiminyEnv with any number of blocks, as a unified pipeline environment class inheriting from BasePipelineWrapper. Each block is wrapped individually and successively.

Parameters
  • env_config (gym_jiminy.common.pipeline.EnvConfig) – Configuration of the environment, as a dict of type EnvConfig.

  • blocks_config (Sequence[gym_jiminy.common.pipeline.BlockConfig]) – Configuration of the blocks, as a list. The list is ordered from the lowest level block to the highest, each element corresponding to the configuration of a individual block, as a dict of type BlockConfig.

Return type

Type[gym_jiminy.common.bases.pipeline_bases.BasePipelineWrapper]

gym_jiminy.common.pipeline.load_pipeline(fullpath)[source]

Load pipeline from JSON or TOML configuration file.

Param

Fullpath of the configuration file.

Parameters

fullpath (str) –

Return type

Type[gym_jiminy.common.bases.pipeline_bases.BasePipelineWrapper]