minor bug fixes

This commit is contained in:
Fabian
2022-07-26 10:33:59 +02:00
parent ce795669a9
commit 4aacd71ed3
2 changed files with 26 additions and 20 deletions
+3 -2
View File
@@ -40,9 +40,10 @@ class TimeAwareObservation(gym.ObservationWrapper):
high = np.append(self.observation_space.high, 1.0)
self.observation_space = Box(low, high, dtype=self.observation_space.dtype)
self.t = 0
self._max_episode_steps = env.spec.max_episode_steps
def observation(self, observation):
"""Adds to the observation with the current time step.
"""Adds to the observation with the current time step normalized with max steps.
Args:
observation: The observation to add the time step to
@@ -50,7 +51,7 @@ class TimeAwareObservation(gym.ObservationWrapper):
Returns:
The observation with the time step appended to
"""
return np.append(observation, self.t/self.env.spec.max_episode_steps)
return np.append(observation, self.t / self._max_episode_steps)
def step(self, action):
"""Steps through the environment, incrementing the time step.