gym-aloha


Namegym-aloha JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA gym environment for ALOHA
upload_time2024-05-03 13:48:28
maintainerNone
docs_urlNone
authorRémi Cadène
requires_python<4.0,>=3.10
licenseApache-2.0
keywords robotics deep reinforcement learning aloha environment gym gymnasium dm-control mujoco
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gym-aloha

A gym environment for ALOHA

<img src="http://remicadene.com/assets/gif/aloha_act.gif" width="50%" alt="ACT policy on ALOHA 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 aloha python=3.10 && conda activate aloha
```

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


## Quickstart

```python
# example.py
import imageio
import gymnasium as gym
import numpy as np
import gym_aloha

env = gym.make("gym_aloha/AlohaInsertion-v0")
observation, info = env.reset()
frames = []

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

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

env.close()
imageio.mimsave("example.mp4", np.stack(frames), fps=25)
```


## Description
Aloha environment.

Two tasks are available:
- TransferCubeTask: The right arm needs to first pick up the red cube lying on the table, then place it inside the gripper of the other arm.
- InsertionTask: The left and right arms need to pick up the socket and peg respectively, and then insert in mid-air so the peg touches the “pins” inside the socket.

### Action Space
The action space consists of continuous values for each arm and gripper, resulting in a 14-dimensional vector:
- Six values for each arm's joint positions (absolute values).
- One value for each gripper's position, normalized between 0 (closed) and 1 (open).

### Observation Space
Observations are provided as a dictionary with the following keys:

- `qpos` and `qvel`: Position and velocity data for the arms and grippers.
- `images`: Camera feeds from different angles.
- `env_state`: Additional environment state information, such as positions of the peg and sockets.

### Rewards
- TransferCubeTask:
    - 1 point for holding the box with the right gripper.
    - 2 points if the box is lifted with the right gripper.
    - 3 points for transferring the box to the left gripper.
    - 4 points for a successful transfer without touching the table.
- InsertionTask:
    - 1 point for touching both the peg and a socket with the grippers.
    - 2 points for grasping both without dropping them.
    - 3 points if the peg is aligned with and touching the socket.
    - 4 points for successful insertion of the peg into the socket.

### Success Criteria
Achieving the maximum reward of 4 points.

### Starting State
The arms and the items (block, peg, socket) start at a random position and angle.

### Arguments

```python
>>> import gymnasium as gym
>>> import gym_aloha
>>> env = gym.make("gym_aloha/AlohaInsertion-v0", obs_type="pixels", render_mode="rgb_array")
>>> env
<TimeLimit<OrderEnforcing<PassiveEnvChecker<AlohaEnv<gym_aloha/AlohaInsertion-v0>>>>>
```

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

* `render_mode`: (str) The rendering mode. Only `rgb_array` is supported for now.

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

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

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

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


## 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-aloha is adapted from [ALOHA](https://tonyzhaozh.github.io/aloha/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "gym-aloha",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "robotics, deep, reinforcement, learning, aloha, environment, gym, gymnasium, dm-control, mujoco",
    "author": "R\u00e9mi Cad\u00e8ne",
    "author_email": "re.cadene@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f4/aa/16e01eecec3e49b22f0d2bffbde5ffbc3df806ede903ed03e4247ac109df/gym_aloha-0.1.0.tar.gz",
    "platform": null,
    "description": "# gym-aloha\n\nA gym environment for ALOHA\n\n<img src=\"http://remicadene.com/assets/gif/aloha_act.gif\" width=\"50%\" alt=\"ACT policy on ALOHA 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 aloha python=3.10 && conda activate aloha\n```\n\nInstall gym-aloha:\n```bash\npip install gym-aloha\n```\n\n\n## Quickstart\n\n```python\n# example.py\nimport imageio\nimport gymnasium as gym\nimport numpy as np\nimport gym_aloha\n\nenv = gym.make(\"gym_aloha/AlohaInsertion-v0\")\nobservation, info = env.reset()\nframes = []\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    frames.append(image)\n\n    if terminated or truncated:\n        observation, info = env.reset()\n\nenv.close()\nimageio.mimsave(\"example.mp4\", np.stack(frames), fps=25)\n```\n\n\n## Description\nAloha environment.\n\nTwo tasks are available:\n- TransferCubeTask: The right arm needs to first pick up the red cube lying on the table, then place it inside the gripper of the other arm.\n- InsertionTask: The left and right arms need to pick up the socket and peg respectively, and then insert in mid-air so the peg touches the \u201cpins\u201d inside the socket.\n\n### Action Space\nThe action space consists of continuous values for each arm and gripper, resulting in a 14-dimensional vector:\n- Six values for each arm's joint positions (absolute values).\n- One value for each gripper's position, normalized between 0 (closed) and 1 (open).\n\n### Observation Space\nObservations are provided as a dictionary with the following keys:\n\n- `qpos` and `qvel`: Position and velocity data for the arms and grippers.\n- `images`: Camera feeds from different angles.\n- `env_state`: Additional environment state information, such as positions of the peg and sockets.\n\n### Rewards\n- TransferCubeTask:\n    - 1 point for holding the box with the right gripper.\n    - 2 points if the box is lifted with the right gripper.\n    - 3 points for transferring the box to the left gripper.\n    - 4 points for a successful transfer without touching the table.\n- InsertionTask:\n    - 1 point for touching both the peg and a socket with the grippers.\n    - 2 points for grasping both without dropping them.\n    - 3 points if the peg is aligned with and touching the socket.\n    - 4 points for successful insertion of the peg into the socket.\n\n### Success Criteria\nAchieving the maximum reward of 4 points.\n\n### Starting State\nThe arms and the items (block, peg, socket) start at a random position and angle.\n\n### Arguments\n\n```python\n>>> import gymnasium as gym\n>>> import gym_aloha\n>>> env = gym.make(\"gym_aloha/AlohaInsertion-v0\", obs_type=\"pixels\", render_mode=\"rgb_array\")\n>>> env\n<TimeLimit<OrderEnforcing<PassiveEnvChecker<AlohaEnv<gym_aloha/AlohaInsertion-v0>>>>>\n```\n\n* `obs_type`: (str) The observation type. Can be either `pixels` or `pixels_agent_pos`. Default is `pixels`.\n\n* `render_mode`: (str) The rendering mode. Only `rgb_array` is supported for now.\n\n* `observation_width`: (int) The width of the observed image. Default is `640`.\n\n* `observation_height`: (int) The height of the observed image. Default is `480`.\n\n* `visualization_width`: (int) The width of the visualized image. Default is `640`.\n\n* `visualization_height`: (int) The height of the visualized image. Default is `480`.\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\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\n## Acknowledgment\n\ngym-aloha is adapted from [ALOHA](https://tonyzhaozh.github.io/aloha/)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A gym environment for ALOHA",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "robotics",
        " deep",
        " reinforcement",
        " learning",
        " aloha",
        " environment",
        " gym",
        " gymnasium",
        " dm-control",
        " mujoco"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c293ae5daa196c12475059427fd3692aac1ad06c501c4f33c0e8fe5e3613c042",
                "md5": "52ee4e2432d1b96b4fb1741926842b78",
                "sha256": "62e36eeb09284422cbb7baca0292c6f65e38ec8774bf9b0bf7159ad5990cf29a"
            },
            "downloads": -1,
            "filename": "gym_aloha-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "52ee4e2432d1b96b4fb1741926842b78",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 446957,
            "upload_time": "2024-05-03T13:48:25",
            "upload_time_iso_8601": "2024-05-03T13:48:25.507191Z",
            "url": "https://files.pythonhosted.org/packages/c2/93/ae5daa196c12475059427fd3692aac1ad06c501c4f33c0e8fe5e3613c042/gym_aloha-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f4aa16e01eecec3e49b22f0d2bffbde5ffbc3df806ede903ed03e4247ac109df",
                "md5": "dd62cdc1a2d53458438ffb2777b640f1",
                "sha256": "bab332f469ba5ffe655fc3e9647aead05d2cb3b950dfb1f299b9539b3857ad7e"
            },
            "downloads": -1,
            "filename": "gym_aloha-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dd62cdc1a2d53458438ffb2777b640f1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 443108,
            "upload_time": "2024-05-03T13:48:28",
            "upload_time_iso_8601": "2024-05-03T13:48:28.363557Z",
            "url": "https://files.pythonhosted.org/packages/f4/aa/16e01eecec3e49b22f0d2bffbde5ffbc3df806ede903ed03e4247ac109df/gym_aloha-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-03 13:48:28",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "gym-aloha"
}
        
Elapsed time: 0.22443s