Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] cartpole_continuous errors when using render_mode='human' #185

Open
StephenWelch opened this issue Aug 30, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@StephenWelch
Copy link

Steps to reproduce

  1. Run the PETS Example with render_mode='human'

Observed Results

The environment errors on the first call to reset() with the following stacktrace:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[2], line 3
      1 seed = 0
      2 env = cartpole_env.CartPoleEnv(render_mode="human")
----> 3 env.reset(seed)
      4 rng = np.random.default_rng(seed=0)
      5 generator = torch.Generator(device=device)

File ~/code/research/mbrl-lib/mbrl/env/cartpole_continuous.py:124, in CartPoleEnv.reset(self, seed)
    122 self.steps_beyond_terminated = None
    123 if self.render_mode == "human":
--> 124     self.render()
    125 return np.array(self.state), {}

File ~/code/research/mbrl-lib/mbrl/env/cartpole_continuous.py:216, in CartPoleEnv.render(self)
    214 if self.render_mode == "human":
    215     pygame.event.pump()
--> 216     self.clock.tick(self.metadata["render_fps"])
    217     pygame.display.flip()
    219 elif self.render_mode == "rgb_array":

KeyError: 'render_fps'

The pygame window opens but displays nothing.

Expected Results

The environment should display in a window.

Relevant Code

In the PETS Example notebook:

env = cartpole_env.CartPoleEnv(render_mode="human")
@StephenWelch StephenWelch added the bug Something isn't working label Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant