mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-26 00:07:41 +00:00
Fix return_info
for wrappers (#2612)
* Fix `return_info` for Observation wrappers, Atari (?) and framestack * Make type checkers and IDEs happier * Merge in #2454 * Update the info dict based on no-op steps Some type hints * Bug fix * Handle resets during frameskip
This commit is contained in:
committed by
GitHub
parent
8dc1b52d21
commit
3fa10a2360
@@ -119,6 +119,14 @@ class FrameStack(ObservationWrapper):
|
||||
return self.observation(), reward, done, info
|
||||
|
||||
def reset(self, **kwargs):
|
||||
observation = self.env.reset(**kwargs)
|
||||
[self.frames.append(observation) for _ in range(self.num_stack)]
|
||||
return self.observation()
|
||||
if kwargs.get("return_info", False):
|
||||
obs, info = self.env.reset(**kwargs)
|
||||
else:
|
||||
obs = self.env.reset(**kwargs)
|
||||
info = None # Unused
|
||||
[self.frames.append(obs) for _ in range(self.num_stack)]
|
||||
|
||||
if kwargs.get("return_info", False):
|
||||
return self.observation(), info
|
||||
else:
|
||||
return self.observation()
|
||||
|
Reference in New Issue
Block a user