A gym wrapper that returns last n_frames observations as a single observation.
Useful for games like Atari and Doom with screen as input.
super(FrameBuffer, self).__init__(env)
shape = (n_frames,) + env.observation_space.shape[1:]
self.observation_space = Box(0.0, 1.0, shape)
self.framebuffer = [np.zeros(shape=env.observation_space.shape)]*n_frames
def _reset(self):
self.framebuffer = [np.zeros_like(self.framebuffer[0])] * len(self.framebuffer)