gym-ignition
gym-ignition copied to clipboard
cartpole observation is never contained in observation_space
Description:
OpenAI Gym changed the way to check if observation_space contains the observation, https://github.com/openai/gym/pull/2374
and thus tasks like cartpole_discrete_balancing.py
are not working anymore due to float64 vs float32 inconsistent usage:
https://github.com/robotology/gym-ignition/blob/fa14f7f8f667cf84bf226756cea158ec0f5c3d23/python/gym_ignition_environments/tasks/cartpole_discrete_balancing.py#L66-L68
vs
https://github.com/robotology/gym-ignition/blob/fa14f7f8f667cf84bf226756cea158ec0f5c3d23/python/gym_ignition_environments/tasks/cartpole_discrete_balancing.py#L94
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
- [x] Nightly
- Installation type:
- [ ] User
- [x] Developer