gym-pusht


Namegym-pusht JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
SummaryA gymnasium environment for PushT.
upload_time2024-05-12 06:20:10
maintainerNone
docs_urlNone
authorRémi Cadène
requires_python<4.0,>=3.10
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gym-pusht

A gymnasium environment PushT.

<img src="http://remicadene.com/assets/gif/pusht_diffusion.gif" width="50%" alt="Diffusion policy on PushT env"/>


## Installation

Create a virtual environment with Python 3.10 and activate it, e.g. with [`miniconda`](https://docs.anaconda.com/free/miniconda/index.html):
```bash
conda create -y -n pusht python=3.10 && conda activate pusht
```

Install gym-pusht:
```bash
pip install gym-pusht
```


## Quick start

```python
# example.py
import gymnasium as gym
import gym_pusht

env = gym.make("gym_pusht/PushT-v0", render_mode="human")
observation, info = env.reset()

for _ in range(1000):
    action = env.action_space.sample()
    observation, reward, terminated, truncated, info = env.step(action)
    image = env.render()

    if terminated or truncated:
        observation, info = env.reset()

env.close()
```

## Description

PushT environment.

The goal of the agent is to push the block to the goal zone. The agent is a circle and the block is a tee shape.

### Action Space

The action space is continuous and consists of two values: [x, y]. The values are in the range [0, 512] and
represent the target position of the agent.

### Observation Space

If `obs_type` is set to `state`, the observation space is a 5-dimensional vector representing the state of the
environment: [agent_x, agent_y, block_x, block_y, block_angle]. The values are in the range [0, 512] for the agent
and block positions and [0, 2*pi] for the block angle.

If `obs_type` is set to `pixels`, the observation space is a 96x96 RGB image of the environment.

### Rewards

The reward is the coverage of the block in the goal zone. The reward is 1.0 if the block is fully in the goal zone.

### Success Criteria

The environment is considered solved if the block is at least 95% in the goal zone.

### Starting State

The agent starts at a random position and the block starts at a random position and angle.

### Episode Termination

The episode terminates when the block is at least 95% in the goal zone.

### Arguments

```python
>>> import gymnasium as gym
>>> import gym_pusht
>>> env = gym.make("gym_pusht/PushT-v0", obs_type="state", render_mode="rgb_array")
>>> env
<TimeLimit<OrderEnforcing<PassiveEnvChecker<PushTEnv<gym_pusht/PushT-v0>>>>>
```

* `obs_type`: (str) The observation type. Can be either `state`, `pixels` or `pixels_agent_pos`. Default is `state`.

* `block_cog`: (tuple) The center of gravity of the block if different from the center of mass. Default is `None`.

* `damping`: (float) The damping factor of the environment if different from 0. Default is `None`.

* `render_mode`: (str) The rendering mode. Can be either `human` or `rgb_array`. Default is `rgb_array`.

* `observation_width`: (int) The width of the observed image. Default is `96`.

* `observation_height`: (int) The height of the observed image. Default is `96`.

* `visualization_width`: (int) The width of the visualized image. Default is `680`.

* `visualization_height`: (int) The height of the visualized image. Default is `680`.

### Reset Arguments

Passing the option `options["reset_to_state"]` will reset the environment to a specific state.

> [!WARNING]
> For legacy compatibility, the inner fonctionning has been preserved, and the state set is not the same as the
> the one passed in the argument.

```python
>>> import gymnasium as gym
>>> import gym_pusht
>>> env = gym.make("gym_pusht/PushT-v0")
>>> state, _ = env.reset(options={"reset_to_state": [0.0, 10.0, 20.0, 30.0, 1.0]})
>>> state
array([ 0.      , 10.      , 57.866196, 50.686398,  1.      ],
        dtype=float32)
```


## Version History

* v0: Original version


## References

* TODO:


## Contribute

Instead of using `pip` directly, we use `poetry` for development purposes to easily track our dependencies.
If you don't have it already, follow the [instructions](https://python-poetry.org/docs/#installation) to install it.

Install the project with dev dependencies:
```bash
poetry install --all-extras
```

### Follow our style

```bash
# install pre-commit hooks
pre-commit install

# apply style and linter checks on staged files
pre-commit
```

## Acknowledgment

gym-pusht is adapted from [Diffusion Policy](https://diffusion-policy.cs.columbia.edu/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "gym-pusht",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "R\u00e9mi Cad\u00e8ne",
    "author_email": "re.cadene@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/08/39/8b84917e438ff31de22f71cfe883011830caf2902bc60a089b68c016a17f/gym_pusht-0.1.4.tar.gz",
    "platform": null,
    "description": "# gym-pusht\n\nA gymnasium environment PushT.\n\n<img src=\"http://remicadene.com/assets/gif/pusht_diffusion.gif\" width=\"50%\" alt=\"Diffusion policy on PushT env\"/>\n\n\n## Installation\n\nCreate a virtual environment with Python 3.10 and activate it, e.g. with [`miniconda`](https://docs.anaconda.com/free/miniconda/index.html):\n```bash\nconda create -y -n pusht python=3.10 && conda activate pusht\n```\n\nInstall gym-pusht:\n```bash\npip install gym-pusht\n```\n\n\n## Quick start\n\n```python\n# example.py\nimport gymnasium as gym\nimport gym_pusht\n\nenv = gym.make(\"gym_pusht/PushT-v0\", render_mode=\"human\")\nobservation, info = env.reset()\n\nfor _ in range(1000):\n    action = env.action_space.sample()\n    observation, reward, terminated, truncated, info = env.step(action)\n    image = env.render()\n\n    if terminated or truncated:\n        observation, info = env.reset()\n\nenv.close()\n```\n\n## Description\n\nPushT environment.\n\nThe goal of the agent is to push the block to the goal zone. The agent is a circle and the block is a tee shape.\n\n### Action Space\n\nThe action space is continuous and consists of two values: [x, y]. The values are in the range [0, 512] and\nrepresent the target position of the agent.\n\n### Observation Space\n\nIf `obs_type` is set to `state`, the observation space is a 5-dimensional vector representing the state of the\nenvironment: [agent_x, agent_y, block_x, block_y, block_angle]. The values are in the range [0, 512] for the agent\nand block positions and [0, 2*pi] for the block angle.\n\nIf `obs_type` is set to `pixels`, the observation space is a 96x96 RGB image of the environment.\n\n### Rewards\n\nThe reward is the coverage of the block in the goal zone. The reward is 1.0 if the block is fully in the goal zone.\n\n### Success Criteria\n\nThe environment is considered solved if the block is at least 95% in the goal zone.\n\n### Starting State\n\nThe agent starts at a random position and the block starts at a random position and angle.\n\n### Episode Termination\n\nThe episode terminates when the block is at least 95% in the goal zone.\n\n### Arguments\n\n```python\n>>> import gymnasium as gym\n>>> import gym_pusht\n>>> env = gym.make(\"gym_pusht/PushT-v0\", obs_type=\"state\", render_mode=\"rgb_array\")\n>>> env\n<TimeLimit<OrderEnforcing<PassiveEnvChecker<PushTEnv<gym_pusht/PushT-v0>>>>>\n```\n\n* `obs_type`: (str) The observation type. Can be either `state`, `pixels` or `pixels_agent_pos`. Default is `state`.\n\n* `block_cog`: (tuple) The center of gravity of the block if different from the center of mass. Default is `None`.\n\n* `damping`: (float) The damping factor of the environment if different from 0. Default is `None`.\n\n* `render_mode`: (str) The rendering mode. Can be either `human` or `rgb_array`. Default is `rgb_array`.\n\n* `observation_width`: (int) The width of the observed image. Default is `96`.\n\n* `observation_height`: (int) The height of the observed image. Default is `96`.\n\n* `visualization_width`: (int) The width of the visualized image. Default is `680`.\n\n* `visualization_height`: (int) The height of the visualized image. Default is `680`.\n\n### Reset Arguments\n\nPassing the option `options[\"reset_to_state\"]` will reset the environment to a specific state.\n\n> [!WARNING]\n> For legacy compatibility, the inner fonctionning has been preserved, and the state set is not the same as the\n> the one passed in the argument.\n\n```python\n>>> import gymnasium as gym\n>>> import gym_pusht\n>>> env = gym.make(\"gym_pusht/PushT-v0\")\n>>> state, _ = env.reset(options={\"reset_to_state\": [0.0, 10.0, 20.0, 30.0, 1.0]})\n>>> state\narray([ 0.      , 10.      , 57.866196, 50.686398,  1.      ],\n        dtype=float32)\n```\n\n\n## Version History\n\n* v0: Original version\n\n\n## References\n\n* TODO:\n\n\n## Contribute\n\nInstead of using `pip` directly, we use `poetry` for development purposes to easily track our dependencies.\nIf you don't have it already, follow the [instructions](https://python-poetry.org/docs/#installation) to install it.\n\nInstall the project with dev dependencies:\n```bash\npoetry install --all-extras\n```\n\n### Follow our style\n\n```bash\n# install pre-commit hooks\npre-commit install\n\n# apply style and linter checks on staged files\npre-commit\n```\n\n## Acknowledgment\n\ngym-pusht is adapted from [Diffusion Policy](https://diffusion-policy.cs.columbia.edu/)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A gymnasium environment for PushT.",
    "version": "0.1.4",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5a064aebf1b727714f4c710ae73572009f252834fd93415c0dfe8daccd9b869",
                "md5": "7a10248ceb65610e9b4cb9c4e505100e",
                "sha256": "04ec628fac80d77cf4edf280ed528ab06f7b8997e4452c78999b4730c2d269ab"
            },
            "downloads": -1,
            "filename": "gym_pusht-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7a10248ceb65610e9b4cb9c4e505100e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 16334,
            "upload_time": "2024-05-12T06:20:08",
            "upload_time_iso_8601": "2024-05-12T06:20:08.279012Z",
            "url": "https://files.pythonhosted.org/packages/d5/a0/64aebf1b727714f4c710ae73572009f252834fd93415c0dfe8daccd9b869/gym_pusht-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08398b84917e438ff31de22f71cfe883011830caf2902bc60a089b68c016a17f",
                "md5": "7f35f84c3001934bd7d6be7ea3012843",
                "sha256": "5926ef8098bde7f6a180bdd34b4ce3a827fb333847cc54d8ad47c430e249f44c"
            },
            "downloads": -1,
            "filename": "gym_pusht-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "7f35f84c3001934bd7d6be7ea3012843",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 16123,
            "upload_time": "2024-05-12T06:20:10",
            "upload_time_iso_8601": "2024-05-12T06:20:10.669879Z",
            "url": "https://files.pythonhosted.org/packages/08/39/8b84917e438ff31de22f71cfe883011830caf2902bc60a089b68c016a17f/gym_pusht-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-12 06:20:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "gym-pusht"
}
        
Elapsed time: 0.38668s