cartpole observation is never contained in observation_space
vfdev-5 opened this issue · comments
vfdev commented
Description:
OpenAI Gym changed the way to check if observation_space contains the observation, openai/gym#2374
and thus tasks like cartpole_discrete_balancing.py
are not working anymore due to float64 vs float32 inconsistent usage:
vs
Steps to reproduce
import gym
import numpy as np
high = np.array(
[
2.4, # x
20.0, # dx
np.deg2rad(12), # q
np.deg2rad(3 * 360), # dq
]
)
# Configure the observation space
obs_high = high.copy() * 1.2
observation_space = gym.spaces.Box(
low=-obs_high, high=obs_high, dtype=np.float32
)
x, dx, q, dq = [0.0, 0.0, 0.0, 0.0]
observation = np.array([x, dx, q, dq])
assert observation_space.contains(observation)
> AssertionError
Environment
- OS:
- GPU:
- Python:
- Version:
- Channel:
- Stable
- Nightly
- Installation type:
- User
- Developer