This repository was archived by the owner on Sep 1, 2024. It is now read-only.
This repository was archived by the owner on Sep 1, 2024. It is now read-only.
[Bug] cartpole_continuous
errors when using render_mode='human'
#185
Open
Description
Steps to reproduce
- 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")
Activity