An open API service indexing awesome lists of open source software.

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.

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 wind

You 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)