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

Is the observation space of CartPole-v0 wrong? #1165

Closed
robert780612 opened this issue Sep 14, 2018 · 2 comments
Closed

Is the observation space of CartPole-v0 wrong? #1165

robert780612 opened this issue Sep 14, 2018 · 2 comments

Comments

@robert780612
Copy link

I got 4.8 from the following code. It means the max cart position is 4.8

import gym
env = gym.make('CartPole-v0')
print(env.observation_space.high[0])

But in the comment from the source code, the max cart position is 2.4.
This is the termination criteria, and it's not the observation upper bound.
Am I right?

Observation: 
    Type: Box(4)
    Num	Observation                 Min         Max
    0	Cart Position             -2.4            2.4
    1	Cart Velocity             -Inf            Inf
    2	Pole Angle                ~-41.8°         ~41.8°
    3	Pole Velocity At Tip      -Inf            Inf

Source code
https://github.com/openai/gym/blob/master/gym/envs/classic_control/cartpole.py#L24

One more thing, the observation space of angle is 24° from line 67 & 74.
https://github.com/openai/gym/blob/master/gym/envs/classic_control/cartpole.py#L67
https://github.com/openai/gym/blob/master/gym/envs/classic_control/cartpole.py#L74

@pzhokhov
Copy link
Collaborator

Correct, the episode is considered terminated when absolute value of position is above 2.4 or absolute value of angle is above 12 degrees. I'll update the docs, thanks for pointing that out

@pzhokhov
Copy link
Collaborator

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants