Skip to content

Commit

Permalink
fix: use unwrapped env to access internal vars (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir-Yashin authored Dec 19, 2024
1 parent 6d8ad1d commit 34ac0d1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions miniworld/manual_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ def on_key_press(symbol, modifiers):
self.env.close()

if symbol == key.UP:
self.step(self.env.actions.move_forward)
self.step(self.env.unwrapped.actions.move_forward)
elif symbol == key.DOWN:
self.step(self.env.actions.move_back)
self.step(self.env.unwrapped.actions.move_back)
elif symbol == key.LEFT:
self.step(self.env.actions.turn_left)
self.step(self.env.unwrapped.actions.turn_left)
elif symbol == key.RIGHT:
self.step(self.env.actions.turn_right)
self.step(self.env.unwrapped.actions.turn_right)
elif symbol == key.PAGEUP or symbol == key.P:
self.step(self.env.actions.pickup)
self.step(self.env.unwrapped.actions.pickup)
elif symbol == key.PAGEDOWN or symbol == key.D:
self.step(self.env.actions.drop)
self.step(self.env.unwrapped.actions.drop)
elif symbol == key.ENTER:
self.step(self.env.actions.done)
self.step(self.env.unwrapped.actions.done)

@env.unwrapped.window.event
def on_key_release(symbol, modifiers):
Expand All @@ -78,9 +78,9 @@ def on_close():
def step(self, action):
print(
"step {}/{}: {}".format(
self.env.step_count + 1,
self.env.max_episode_steps,
self.env.actions(action).name,
self.env.unwrapped.step_count + 1,
self.env.unwrapped.max_episode_steps,
self.env.unwrapped.actions(action).name,
)
)

Expand Down

0 comments on commit 34ac0d1

Please sign in to comment.