Skip to content

tkkim-robot/unstable_gym

Repository files navigation

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,

python unstable_pendulum.py

For cartpole(continuous action),

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:

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:

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 and Smooth_MPPI

About

A gym-like classical control benchmark for evaluating the robustnesses of control and reinforcement learning algorithms.

Topics

Resources

Stars

Watchers

Forks

Languages