https://github.com/ttitcombe/cartpoleswingup
Custom environment for OpenAI gym
https://github.com/ttitcombe/cartpoleswingup
cartpole cartpole-environment cartpole-v1 gym gym-environment gym-environments openai-gym openai-gym-environment openai-gym-environments reinforcement-learning-environments
Last synced: 8 months ago
JSON representation
Custom environment for OpenAI gym
- Host: GitHub
- URL: https://github.com/ttitcombe/cartpoleswingup
- Owner: TTitcombe
- License: mit
- Created: 2019-07-16T07:16:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-09T10:28:22.000Z (about 6 years ago)
- Last Synced: 2023-12-16T16:14:19.727Z (almost 2 years ago)
- Topics: cartpole, cartpole-environment, cartpole-v1, gym, gym-environment, gym-environments, openai-gym, openai-gym-environment, openai-gym-environments, reinforcement-learning-environments
- Language: Python
- Size: 8.79 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CartPoleSwingUp
*CartPoleSwingUp* is a custom gym environment, adapted from [hardmaru's version](https://github.com/hardmaru/estool/blob/master/custom_envs/cartpole_swingup.py).
*Swing-up* is a more complex version of the popular *CartPole* gym environment. In swing-up, the cart must first swing
the pole to an upright position before balancing it as in normal CartPole.This adapted version includes a non-continuous version of the environment for use with models such as DQN.
**Note:** this env currently does not work with the latest versions of *gym*. I am working to correct this.
### How to use
Either copy the file containing the environment to your own codebase, or install the repo with `pip install git+https://github.com/TTitcombe/CartPoleSwingUp.git`.
You can then import the code with `import CartPoleSwingUp`.
Once you've imported the environment class, you can simply call `env = CartPoleSwingUpEnv()`.
However, if you do not want to hard-code an environment, I have created a helper function which defaults to gym behaviour if using any other env:
```python
from cartpoleswingup import makeswing_up_env = make("CartPoleSwingUp")
cartpole_env = make("CartPole-v1")
```