# gym-xarm
A gym environment for xArm
<td><img src="http://remicadene.com/assets/gif/simxarm_tdmpc.gif" width="50%" alt="TDMPC policy on xArm env"/></td>
## 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 xarm python=3.10 && conda activate xarm
```
Install gym-xarm:
```bash
pip install gym-xarm
```
## Quickstart
```python
# example.py
import gymnasium as gym
import gym_xarm
env = gym.make("gym_xarm/XarmLift-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()
```
To use this [example](./example.py) with `render_mode="human"`, you should set the environment variable `export MUJOCO_GL=glfw` or simply run
```bash
MUJOCO_GL=glfw python example.py
```
## Description for `Lift` task
The goal of the agent is to lift the block above a height threshold. The agent is an xArm robot arm and the block is a cube.
### Action Space
The action space is continuous and consists of four values [x, y, z, w]:
- [x, y, z] represent the position of the end effector
- [w] represents the gripper control
### Observation Space
Observation space is dependent on the value set to `obs_type`:
- `"state"`: observations contain agent and object state vectors only (no rendering)
- `"pixels"`: observations contains rendered image only (no state vectors)
- `"pixels_agent_pos"`: contains rendered image and agent state vector
## 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-xarm is adapted from [FOWM](https://www.yunhaifeng.com/FOWM/) and is based on work by [Nicklas Hansen](https://nicklashansen.github.io/), [Yanjie Ze](https://yanjieze.com/), [Rishabh Jangir](https://jangirrishabh.github.io/), [Mohit Jain](https://natsu6767.github.io/), and [Sambaran Ghosal](https://github.com/SambaranRepo) as part of the following publications:
* [Self-Supervised Policy Adaptation During Deployment](https://arxiv.org/abs/2007.04309)
* [Generalization in Reinforcement Learning by Soft Data Augmentation](https://arxiv.org/abs/2011.13389)
* [Stabilizing Deep Q-Learning with ConvNets and Vision Transformers under Data Augmentation](https://arxiv.org/abs/2107.00644)
* [Look Closer: Bridging Egocentric and Third-Person Views with Transformers for Robotic Manipulation](https://arxiv.org/abs/2201.07779)
* [Visual Reinforcement Learning with Self-Supervised 3D Representations](https://arxiv.org/abs/2210.07241)
Raw data
{
"_id": null,
"home_page": null,
"name": "gym-xarm",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "robotics, deep, reinforcement, learning, xarm, environment, gym, gymnasium, mujoco",
"author": "R\u00e9mi Cad\u00e8ne",
"author_email": "re.cadene@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1a/14/c7ea1ce2b11ee4c15f065cb86bb0a6bf7737aa40996e81c60c6ea470e7c7/gym_xarm-0.1.0.tar.gz",
"platform": null,
"description": "# gym-xarm\n\nA gym environment for xArm\n\n<td><img src=\"http://remicadene.com/assets/gif/simxarm_tdmpc.gif\" width=\"50%\" alt=\"TDMPC policy on xArm env\"/></td>\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 xarm python=3.10 && conda activate xarm\n```\n\nInstall gym-xarm:\n```bash\npip install gym-xarm\n```\n\n\n## Quickstart\n\n```python\n# example.py\nimport gymnasium as gym\nimport gym_xarm\n\nenv = gym.make(\"gym_xarm/XarmLift-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\nTo use this [example](./example.py) with `render_mode=\"human\"`, you should set the environment variable `export MUJOCO_GL=glfw` or simply run\n```bash\nMUJOCO_GL=glfw python example.py\n```\n\n## Description for `Lift` task\n\nThe goal of the agent is to lift the block above a height threshold. The agent is an xArm robot arm and the block is a cube.\n\n### Action Space\n\nThe action space is continuous and consists of four values [x, y, z, w]:\n- [x, y, z] represent the position of the end effector\n- [w] represents the gripper control\n\n### Observation Space\n\nObservation space is dependent on the value set to `obs_type`:\n- `\"state\"`: observations contain agent and object state vectors only (no rendering)\n- `\"pixels\"`: observations contains rendered image only (no state vectors)\n- `\"pixels_agent_pos\"`: contains rendered image and agent state vector\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\n## Acknowledgment\n\ngym-xarm is adapted from [FOWM](https://www.yunhaifeng.com/FOWM/) and is based on work by [Nicklas Hansen](https://nicklashansen.github.io/), [Yanjie Ze](https://yanjieze.com/), [Rishabh Jangir](https://jangirrishabh.github.io/), [Mohit Jain](https://natsu6767.github.io/), and [Sambaran Ghosal](https://github.com/SambaranRepo) as part of the following publications:\n* [Self-Supervised Policy Adaptation During Deployment](https://arxiv.org/abs/2007.04309)\n* [Generalization in Reinforcement Learning by Soft Data Augmentation](https://arxiv.org/abs/2011.13389)\n* [Stabilizing Deep Q-Learning with ConvNets and Vision Transformers under Data Augmentation](https://arxiv.org/abs/2107.00644)\n* [Look Closer: Bridging Egocentric and Third-Person Views with Transformers for Robotic Manipulation](https://arxiv.org/abs/2201.07779)\n* [Visual Reinforcement Learning with Self-Supervised 3D Representations](https://arxiv.org/abs/2210.07241)\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "A gym environment for xArm",
"version": "0.1.0",
"project_urls": null,
"split_keywords": [
"robotics",
" deep",
" reinforcement",
" learning",
" xarm",
" environment",
" gym",
" gymnasium",
" mujoco"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8b333b467191346138c794f21e227572a4df77c112e74566088566a0410bfada",
"md5": "e1237175703714635e25d3591ce5537f",
"sha256": "d10ac19a59d302201a9b8bd913530211b1058467b787ad91a657907e40cdbc13"
},
"downloads": -1,
"filename": "gym_xarm-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e1237175703714635e25d3591ce5537f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 2256451,
"upload_time": "2024-05-03T13:50:19",
"upload_time_iso_8601": "2024-05-03T13:50:19.889779Z",
"url": "https://files.pythonhosted.org/packages/8b/33/3b467191346138c794f21e227572a4df77c112e74566088566a0410bfada/gym_xarm-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1a14c7ea1ce2b11ee4c15f065cb86bb0a6bf7737aa40996e81c60c6ea470e7c7",
"md5": "5c2c3b91e17e380d84efeca8f85ed8c7",
"sha256": "fc05f9d02af1f0205275311669dc191ce431be484e221a96401eb544764eb986"
},
"downloads": -1,
"filename": "gym_xarm-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5c2c3b91e17e380d84efeca8f85ed8c7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 2246989,
"upload_time": "2024-05-03T13:50:22",
"upload_time_iso_8601": "2024-05-03T13:50:22.423762Z",
"url": "https://files.pythonhosted.org/packages/1a/14/c7ea1ce2b11ee4c15f065cb86bb0a6bf7737aa40996e81c60c6ea470e7c7/gym_xarm-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-03 13:50:22",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "gym-xarm"
}