mani_skill.utils.wrappers.frame_stack#

Wrapper that stacks frames. Adapted from gymnasium package to support GPU vectorizated environments.

Classes#

FrameStack

Observation wrapper that stacks the observations in a rolling manner.

Module Contents#

class mani_skill.utils.wrappers.frame_stack.FrameStack(env, num_stack, lz4_compress=False)[source]#

Bases: gymnasium.ObservationWrapper

Observation wrapper that stacks the observations in a rolling manner.

For example, if the number of stacks is 4, then the returned observation contains the most recent 4 observations. For environment ‘PickCube-v1’, the original observation is an array with shape [42], so if we stack 4 observations, the processed observation has shape [4, 42].

This wrapper also supports dict observations, and will stack the leafs of the dictionary accordingly.

Note

  • After reset() is called, the frame buffer will be filled with the initial observation. I.e. the observation returned by reset() will consist of num_stack many identical frames.

Parameters:
  • env (gymnasium.Env) –

  • num_stack (int) –

  • lz4_compress (bool) –

observation(observation)[source]#

Returns a modified observation.

Parameters:

observation – The env observation

Returns:

The modified observation

reset(seed=None, options=None)[source]#

Reset the environment with kwargs.

Parameters:
  • seed – The seed for the environment reset

  • options – The options for the environment reset

Returns:

The stacked observations

step(action)[source]#

Steps through the environment, appending the observation to the frame buffer.

Parameters:

action – The action to step through the environment with

Returns:

Stacked observations, reward, terminated, truncated, and information from the environment

property base_env: mani_skill.envs.sapien_env.BaseEnv[source]#
Return type:

mani_skill.envs.sapien_env.BaseEnv

frames[source]#
lz4_compress = False[source]#
num_stack[source]#
use_dict[source]#