https://github.com/huggingface/gym-pusht

A gym environment for PushT

https://github.com/huggingface/gym-pusht

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.7%) to scientific vocabulary
Last synced: 4 months ago · JSON representation

Repository

A gym environment for PushT

Basic Info
  • Host: GitHub
  • Owner: huggingface
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 107 KB
Statistics
  • Stars: 137
  • Watchers: 7
  • Forks: 22
  • Open Issues: 13
  • Releases: 0
Created almost 2 years ago · Last pushed 5 months ago
Metadata Files
Readme License

README.md

gym-pusht

A gymnasium environment PushT.

Diffusion policy on PushT env

Installation

Create a virtual environment with Python 3.10 and activate it, e.g. with miniconda: 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("gympusht/PushT-v0", rendermode="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: [agentx, agenty, blockx, blocky, 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 environment_state_agent_pos the observation space is a dictionary with: - environment_state: 16-dimensional vector representing the keypoint locations of the T (in [x0, y0, x1, y1, ...] format). The values are in the range [0, 512]. - agent_pos: A 2-dimensional vector representing the position of the robot end-effector.

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 gympusht env = gym.make("gympusht/PushT-v0", obstype="state", rendermode="rgbarray") env <TimeLimit<OrderEnforcing<PassiveEnvChecker<PushTEnv<gympusht/PushT-v0>>>>> ```

  • obs_type: (str) The observation type. Can be either state, environment_state_agent_pos, 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 functioning 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 gympusht env = gym.make("gympusht/PushT-v0") state, _ = env.reset(options={"resettostate": [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 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

Owner

  • Name: Hugging Face
  • Login: huggingface
  • Kind: organization
  • Location: NYC + Paris

The AI community building the future.

GitHub Events

Total
  • Issues event: 6
  • Watch event: 72
  • Issue comment event: 9
  • Pull request review event: 3
  • Pull request review comment event: 1
  • Pull request event: 3
  • Fork event: 15
Last Year
  • Issues event: 6
  • Watch event: 72
  • Issue comment event: 9
  • Pull request review event: 3
  • Pull request review comment event: 1
  • Pull request event: 3
  • Fork event: 15

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 5
  • Total pull requests: 9
  • Average time to close issues: N/A
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 5
  • Total pull request authors: 4
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 5
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 5
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • baopeg (1)
  • lucasjinreal (1)
  • WMWMW1 (1)
  • c0g (1)
  • ronjian (1)
Pull Request Authors
  • aliberts (6)
  • the-future-dev (1)
  • alexander-soare (1)
  • eric-rosen (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/test.yml actions
  • actions/cache/restore v3 composite
  • actions/cache/save v3 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • snok/install-poetry v1 composite
poetry.lock pypi
  • cffi 1.16.0
  • cfgv 3.4.0
  • cloudpickle 3.0.0
  • colorama 0.4.6
  • coverage 7.4.4
  • debugpy 1.8.1
  • distlib 0.3.8
  • exceptiongroup 1.2.0
  • farama-notifications 0.0.4
  • filelock 3.13.3
  • gymnasium 0.29.1
  • identify 2.5.35
  • imageio 2.34.0
  • iniconfig 2.0.0
  • lazy-loader 0.3
  • networkx 3.2.1
  • nodeenv 1.8.0
  • numpy 1.26.4
  • opencv-python 4.9.0.80
  • packaging 24.0
  • pillow 10.3.0
  • platformdirs 4.2.0
  • pluggy 1.4.0
  • pre-commit 3.7.0
  • pycparser 2.22
  • pygame 2.5.2
  • pymunk 6.6.0
  • pytest 8.1.1
  • pytest-cov 5.0.0
  • pyyaml 6.0.1
  • scikit-image 0.22.0
  • scipy 1.12.0
  • setuptools 69.2.0
  • shapely 2.0.3
  • tifffile 2024.2.12
  • tomli 2.0.1
  • typing-extensions 4.10.0
  • virtualenv 20.25.1
pyproject.toml pypi
  • debugpy ^1.8.1 develop
  • pre-commit ^3.6.2 develop
  • gymnasium ^0.29.1
  • opencv-python ^4.9.0.80
  • pygame ^2.5.2
  • pymunk ^6.6.0
  • python ^3.10
  • scikit-image ^0.22.0
  • shapely ^2.0.3
  • pytest ^8.1.0 test
  • pytest-cov ^5.0.0 test
.github/workflows/quality.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite