Skip to main content

gym-xarm

A gym environment for xArm

TDMPC policy on xArm env

Installation

Create a virtual environment with Python 3.10 and activate it, e.g. with miniconda:

conda create -y -n xarm python=3.10 && conda activate xarm

Install gym-xarm:

pip install gym-xarm

Quickstart

# 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 with render_mode="human", you should set the environment variable export MUJOCO_GL=glfw or simply run

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 to install it.

Install the project with dev dependencies:

poetry install --all-extras

Follow our style

# install pre-commit hooks
pre-commit install

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

Acknowledgment

gym-xarm is adapted from FOWM and is based on work by Nicklas Hansen, Yanjie Ze, Rishabh Jangir, Mohit Jain, and Sambaran Ghosal as part of the following publications:

Metadata

Release files for gym-xarm 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gym-xarm 0.1.1
File Size Uploaded
gym_xarm-0.1.1.tar.gz 2.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for gym-xarm 0.1.1
File Interpreter ABI Platform
gym_xarm-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 4.5 MB

Release files / gym_xarm-0.1.1.tar.gz

Download URL gym_xarm-0.1.1.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
e455524561b02d06b92a4f7d524f448d84a7484d9a2dbc78600e3c66240e0fb7
BLAKE2b-256 checksum
How to use checksums
2a1c77aac8cbf50b8f8715f5ebeb68214452e3adf4531c9b9f6fefdff09f7267
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

Release files / gym_xarm-0.1.1-py3-none-any.whl

Download URL gym_xarm-0.1.1-py3-none-any.whl
Size 2.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
3bd7e3c1c5521ba80a56536f01a5e11321580704d72160355ce47a828a8808ad
BLAKE2b-256 checksum
How to use checksums
11961f96ac0803032596e8483ae133ce04b52b10f151c3dbcefbba029f7290a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page