Open vfdev-5 opened 2 years ago
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:
cartpole_discrete_balancing.py
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
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
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
Environment