Git Product home page Git Product logo

xarm6-gym-env's Introduction

xArm6 inverse kinematics with DDPG+HER

gym-xarm6 is a gym environment for path planning with xArm6 robot using openai gym framework. The environment Creation of a new environment in OpenAI gym for the xArm6 robot from UFactory. The model uses Deep Deterministic Policy Gradient (DDPG) for continious actions and Hindsight Experience Replay (HER).

Installation

Requirements

  • python3.6+ environment by one of the following:
    • conda
    • virtualenv
    • venv
    • system python
  • swig
  • libosmesa6-dev
  • patchelf
  • libopenmpi-dev
  • mpi4py (install it with pip or conda)
  • openai baselines

Follow this instructions to be able to use the xArm6 enviroment for OpenAI gym. You can use your own policies to train the model, but here we will use DDPG + HER.

Before the installation, we need to get MuJoCo (multi-joint dynamics in contact) physics simulator.

Note: For easier installation we recomend using Unix based OS.

  1. The code was tested on Ubuntu 20.04, Debian 11 succesfully.
  2. Have fun manipulating the code and the model!
  1. Download MuJoCo
  2. Create a folder in your home directory named .mujoco and unzip the file here.
  3. Download the activation key licence and put it inside .mujoco/mujoco200/ and .mujoco/mujoco200/bin/.
  4. Modify the .bashrc and add the following lines:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/home/dir/.mujoco/mujoco200/bin
  1. Test that MuJoCo is working properly.
cd ~/.mujoco/mujoco200/bin
./simulate ../models/humanoid.xml

Now clone this repository.

git clone https://github.com/ollintzinlab/xArm6-Gym-Env.git

Once you have it, cd into the cloned directory an run pip install -e . to install the environment.

Test

Train the model by running:

python her/train.py --env-name="xArm6Reach-v0" | tee her/reach.log

Test the model by running:

python her/demo.py --env-name="xArm6Reach-v0"

Usage

In gym_xarm6/envs/reach.py you can modify the position of the robot in the world frame.

...
        initial_qpos = {
            'robot0:slide0': 0.,
            'robot0:slide1': 0.,
            'robot0:slide2': 0.,
        }
...

The variable distance_threshold allows you to change de precision of the robot. It is used to calculate the normal distance from the tool frame of the robot to the target position in a cartesian frame.

xarm6-gym-env's People

Contributors

julio-design avatar

Stargazers

 avatar Jaedong Lee avatar 十年一梦 avatar  avatar Yuki_Ishiyama avatar XYC avatar  avatar  avatar Vivek Sahukar avatar

Watchers

 avatar

xarm6-gym-env's Issues

maybe pip install -e . error

the problem at the beginning:

Screenshot from 2023-12-06 15-43-32

Obtaining file:///home/ubuntu/xArm6-Gym-Env
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
/home/ubuntu/anaconda3/envs/xarm6/lib/python3.8/site-packages/setuptools/_distutils/dist.py:250: UserWarning: 'licence' distribution option is deprecated; use 'license'
warnings.warn(msg)
error: Multiple top-level packages discovered in a flat-layout: ['her', 'gym_xarm6', 'pybullet_env'].

  To avoid accidental inclusion of unwanted files or directories,
  setuptools will not proceed with this build.
  
  If you are trying to create a single distribution with multiple packages
  on purpose, you should not rely on automatic discovery.
  Instead, consider the following options:
  
  1. set up custom discovery (`find` directive with `include` or `exclude`)
  2. use a `src-layout`
  3. explicitly set `py_modules` or `packages` with a list of names
  
  To find more information, look for "package discovery" on setuptools docs.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.