Code Monkey home page Code Monkey logo

tiago_gym's Introduction

🦾 tiago_gym

A ROS package to run Reinforcement Learning experiments, particularly pick and place tasks, on the TIAGo robot. Uses Gazebo, Rviz and MoveIt! (for motion planning)

rviz-showcase

Installation

Tested on Ubuntu 18.04 only. Beware! Instructions assume familiarity with the ROS packages system.

  • Install ROS Melodic + TIAGo
  • Install openai_ros package into your TIAGo workspace
     cd /home/user/tiago_public_ws/src
     git clone https://bitbucket.org/theconstructcore/openai_ros.git
     cd openai_ros;git checkout version2
     cd /home/user/tiago_public_ws;catkin_make;source devel/setup.bash
  • Install tiago_gym package into your TIAGo workspace
     cd /home/user/tiago_public_ws/src
     git clone https://github.com/edluffy/tiago_gym
     cd /home/user/tiago_public_ws;catkin_make;source devel/setup.bash
  • Launch an environment!
    • roslaunch tiago_gym start_gym.launch
    • Gazebo and Rviz should launch similarly to gif above.
    • To speed up simulation you can run the command gz physics –u 0 -s 0.0025 in a separate terminal.
  • Running custom training scripts
    • Launch with roslaunch tiago_gym start_gym.launch train:=false
    • Run in a separate terminal python my_training_script.py. Example snippets are shown in the Environments section.

Environments

TiagoSimpleEnv-v0 TiagoReachEnv-v0
tiago_gym_simple tiago_gym_reach

TiagoSimpleEnv-v0

This is a simple test environment in which the robot gripper must move to a discrete goal position in 3D space (essentially a 3D gridworld). Example usage:

import tiago_simple_env
from agents import dqn

env = gym.make('TiagoSimpleEnv-v0')
o_dims = len(env.observation_space.sample())
a_dims = env.action_space.n

agent = dqn.DQN(env, input_size=o_dims,
        output_size=o_dims, alpha=0.01, epsilon_decay=0.95)
agent.run(100)
Observations ActionsRewards(Dense!)
0 x-pos of gripper
1 y-pos of gripper
2 z-pos of gripper
0 x-pos of gripper + 0.1
1 x-pos of gripper - 0.1
2 y-pos of gripper + 0.1
3 y-pos of gripper - 0.1
4 z-pos of gripper + 0.1
5 z-pos of gripper - 0.1
Goal within 0.05 10
Else -Distance to goal

TiagoReachEnv-v0

A continuous action environment – robot can move a vector distance in any direction to get to the goal. Example usage:

import tiago_reach_env
from agents import ddpg

env = gym.make('TiagoReachEnv-v0')
o_dims = len(env.observation_space.sample())
a_dims = env.action_space.shape[0]
a_high = env.action_space.high
    
agent = ddpg.DDPG(env, o_dims, a_dims, a_high)
agent.run(100)
Observations ActionsRewards(Dense!)
0 absolute pos of gripper
1 relative pos of gripper
0 x-pos of gripper
1 x-pos of gripper
2 y-pos of gripper
Goal within 0.05 10
Else -Distance to goal

Agents

  • Tensorflow implementations of DQN and DDPG can be found in scripts/agents.

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.