fancy_gym/README.md

88 lines
4.2 KiB
Markdown
Raw Normal View History

<h1 align="center">
2023-06-27 21:39:03 +02:00
<br>
<img src='https://raw.githubusercontent.com/ALRhub/fancy_gym/master/icon.svg' width="250px">
2023-06-27 21:39:03 +02:00
<br><br>
<b>Fancy Gym</b>
2023-10-11 13:28:03 +02:00
<br><br>
</h1>
2023-10-11 13:28:03 +02:00
Built upon the foundation of [Gymnasium](https://gymnasium.farama.org/) (a maintained fork of OpenAIs renowned Gym library) `fancy_gym` offers a comprehensive collection of reinforcement learning environments.
2023-09-17 18:37:40 +02:00
**Key Features**:
2024-01-23 17:15:24 +01:00
- **New Challenging Environments**: `fancy_gym` includes several new environments ([Panda Box Pushing](https://dominik-roth.eu/fancy/envs/fancy/mujoco.html#box-pushing), [Table Tennis](https://dominik-roth.eu/fancy/envs/fancy/mujoco.html#table-tennis), [etc.](https://dominik-roth.eu/fancy/envs/fancy/index.html)) that present a higher degree of difficulty, pushing the boundaries of reinforcement learning research.
2023-09-18 17:41:10 +02:00
- **Support for Movement Primitives**: `fancy_gym` supports a range of movement primitives (MPs), including Dynamic Movement Primitives (DMPs), Probabilistic Movement Primitives (ProMP), and Probabilistic Dynamic Movement Primitives (ProDMP).
2024-01-23 17:15:24 +01:00
- **Upgrade to Movement Primitives**: With our framework, its straightforward to transform standard Gymnasium environments into environments that support movement primitives.
- **Benchmark Suite Compatibility**: `fancy_gym` makes it easy to access renowned benchmark suites such as [DeepMind Control](dominik-roth.eu/fancy/envs/dmc.html)
and [Metaworld](https://dominik-roth.eu/fancy/envs/meta.html), whether you want to use them in the regular step-based setting or using MPs.
- **Contribute Your Own Environments**: If youre inspired to create custom gym environments, both step-based and with movement primitives, this [guide](https://dominik-roth.eu/fancy/guide/upgrading_envs.html) will assist you. We encourage and highly appreciate submissions via PRs to integrate these environments into `fancy_gym`.
2024-01-23 17:15:24 +01:00
## Quickstart Guide
2021-08-23 17:24:55 +02:00
2024-01-23 17:20:45 +01:00
| &#x2139; We recommend installing `fancy_gym` into a virtual environment as provided by [venv](https://docs.python.org/3/library/venv.html), [Poetry](https://python-poetry.org/) or [Conda](https://docs.conda.io/en/latest/). |
2024-01-23 17:15:24 +01:00
| ----------------------------------------------------------------------------------------------------------------------------------------------- |
2021-08-23 17:24:55 +02:00
2024-01-23 17:15:24 +01:00
Install via pip (`or use an alternative installation method <guide/installation.html>`\_\_)
2024-01-18 10:20:19 +01:00
```bash
2024-01-23 17:15:24 +01:00
pip install 'fancy_gym[all]'
```
2024-01-23 17:15:24 +01:00
Try out one of our step-based environments (`or explore our other envs <envs/fancy/index.html>`\_\_)
2022-07-13 16:52:24 +02:00
2021-08-23 17:24:55 +02:00
```python
2024-01-23 17:15:24 +01:00
import gymnasium as gym
import fancy_gym
import time
2021-08-23 17:24:55 +02:00
2024-01-23 17:15:24 +01:00
env = gym.make('fancy/BoxPushingDense-v0', render_mode='human')
observation = env.reset()
env.render()
2021-08-23 17:24:55 +02:00
2024-01-23 17:15:24 +01:00
for i in range(1000):
action = env.action_space.sample() # Randomly sample an action
observation, reward, terminated, truncated, info = env.step(action)
time.sleep(1/env.metadata['render_fps'])
2021-08-23 17:24:55 +02:00
2024-01-23 17:15:24 +01:00
if terminated or truncated:
observation, info = env.reset()
2021-08-23 17:24:55 +02:00
```
2024-01-23 17:15:24 +01:00
Explore the MP-based variant (`or learn more about Movement Primitives (MPs) <guide/episodic_rl.html>`\_\_)
2023-09-17 18:37:40 +02:00
2021-08-23 17:24:55 +02:00
```python
2024-01-23 17:15:24 +01:00
import gymnasium as gym
import fancy_gym
2021-08-23 17:24:55 +02:00
2024-01-23 17:15:24 +01:00
env = gym.make('fancy_ProMP/BoxPushingDense-v0', render_mode='human')
env.reset()
env.render()
2021-08-23 17:24:55 +02:00
2024-01-23 17:15:24 +01:00
for i in range(10):
action = env.action_space.sample() # Randomly sample MP parameters
observation, reward, terminated, truncated, info = env.step(action) # Will execute full trajectory, based on MP
observation = env.reset()
2023-09-17 18:37:40 +02:00
```
2024-01-23 17:15:24 +01:00
## Documentation
2021-08-23 17:24:55 +02:00
2024-01-23 17:15:24 +01:00
Documentation for `fancy_gym` can be found [here](https://dominik-roth.eu/fancy); Usage Examples can be found [here](https://dominik-roth.eu/fancy/examples/general.html).
2023-06-27 21:43:22 +02:00
2023-10-11 11:56:51 +02:00
## Citing the Project
To cite this repository in publications:
```bibtex
@software{fancy_gym,
title = {Fancy Gym},
2023-10-11 11:56:51 +02:00
author = {Otto, Fabian and Celik, Onur and Roth, Dominik and Zhou, Hongyi},
abstract = {Fancy Gym: Unifying interface for various RL benchmarks with support for Black Box approaches.},
url = {https://github.com/ALRhub/fancy_gym},
organization = {Autonomous Learning Robots Lab (ALR) at KIT},
2023-10-11 11:56:51 +02:00
}
```
2023-06-28 22:20:49 +02:00
## Icon Attribution
2023-09-20 12:49:31 +02:00
2023-06-28 22:20:49 +02:00
The icon is based on the [Gymnasium](https://github.com/Farama-Foundation/Gymnasium) icon as can be found [here](https://gymnasium.farama.org/_static/img/gymnasium_black.svg).