Skip to main content

A gym environment for xArm

Project description

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gym_xarm-0.1.1.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

gym_xarm-0.1.1-py3-none-any.whl (2.3 MB view details)

Uploaded Python 3

File details

Details for the file gym_xarm-0.1.1.tar.gz.

File metadata

  • Download URL: gym_xarm-0.1.1.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

File hashes

Hashes for gym_xarm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e455524561b02d06b92a4f7d524f448d84a7484d9a2dbc78600e3c66240e0fb7
MD5 1515f6197501ecdbb6054e9689d8972f
BLAKE2b-256 2a1c77aac8cbf50b8f8715f5ebeb68214452e3adf4531c9b9f6fefdff09f7267

See more details on using hashes here.

File details

Details for the file gym_xarm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gym_xarm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

File hashes

Hashes for gym_xarm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3bd7e3c1c5521ba80a56536f01a5e11321580704d72160355ce47a828a8808ad
MD5 692ae0f906afdf024bd36d5a9d95b76f
BLAKE2b-256 11961f96ac0803032596e8483ae133ce04b52b10f151c3dbcefbba029f7290a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page