https://github.com/tkkim-robot/unstable_gym
A gym-like classical control benchmark for evaluating the robustnesses of control and reinforcement learning algorithms.
https://github.com/tkkim-robot/unstable_gym
benchmark control gym mbrl mppi pendulum robustness smppi
Last synced: 19 days ago
JSON representation
A gym-like classical control benchmark for evaluating the robustnesses of control and reinforcement learning algorithms.
- Host: GitHub
- URL: https://github.com/tkkim-robot/unstable_gym
- Owner: tkkim-robot
- Created: 2021-11-24T11:43:46.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-11T14:12:50.000Z (about 3 years ago)
- Last Synced: 2023-10-11T12:36:43.551Z (over 1 year ago)
- Topics: benchmark, control, gym, mbrl, mppi, pendulum, robustness, smppi
- Language: Python
- Homepage:
- Size: 3.1 MB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Benchmark for Robustness Tests of Control Alrogithms
This repository contains classical control benchmarks for evaluating robustnesses of control and reinforcement learning algorithms. It can be used as zero-shot control performance evaluations. It is built upon OpenAI Gym.
# Installation
Clone repository, then 'pip install -e .' or 'pip3 install -e .' based on your environment.
Or you can manually install dependencies:
- numpy
- gym# How to Run Example
You can run our test example by:
For pendulum,
```bash
python unstable_pendulum.py
```
For cartpole(continuous action),
```bash
python unstable_cartpole_cont.py
```It's an inverted pendulum in gym environment. The sample results of the two different winds are shown below:
| Sine wave side wind | Random side wind |
| :--------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------: |
||
|
It's a cartpole (continuous action) environment. The sample results of the two different winds are shown below:
| Sine wave side wind | Random side wind |
| :--------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------: |
||
|
# How to Use
Simply import environments from 'unstable_gym'. For examples, for [inverted pendulum](https://github.com/ktk1501/unstable_gym/blob/master/unstable_pendulum.py):
```python
from unstable_gym.unstable_pendulum import UnstablePendulumEnv
env = UnstablePendulumEnv(wind_type="sine", max_wind=1.0)obs = env.reset()
for step in range(500):
action = env.action_space.sample()
nobs, reward, done, info = env.step(action)
env.render()
```
For [cartpole](https://github.com/ktk1501/unstable_gym/blob/master/unstable_cartpole_cont.py):```python
from unstable_gym.unstable_cartpole_cont import UnstableCartPoleContEnv
env = UnstableCartPoleContEnv(wind_type="sine", max_wind=1.0)for ep in range(10):
obs = env.reset()
for step in range(1000):
action = env.action_space.sample()
nobs, reward, done, info = env.step(action)
env.render()
if done:
break
```
There are two options for "wind type":1. **"sine"** : sine wave side wind
2. **"random"** : random side windYou can also adjust the magnitude of the side wind (in [N]): "max_wind"
# Related Works
You can test the robustness of [MPPI](https://github.com/UM-ARM-Lab/pytorch_mppi) and [Smooth_MPPI](https://github.com/ktk1501/smooth-mppi-pytorch)