Package: gym-sawyer
gym-sawyerSawyer environments for reinforcement learning that use the OpenAI Gym
interface, as well as Dockerfiles with ROS to communicate with the real robot
or a simulated one with Gazebo.This repository is under development, so all code is still experimental.Docker containersSawyer SimulationWe use Gazebo to simulate Sawyer, so a dedicated GPU is required
(see System Requirements).
Currently only NVIDIA GPUs are supported.NVIDIA GPUThis section contains instructions to build the docker image and run the docker
container for the simulated Sawyer in the ROS environment using an NVIDIA GPU.PrerequisitesInstallDocker CEInstallDocker ComposeInstall the latest NVIDIA driver, tested
onnvidia-390Install nvidia-docker2Clone this repository in your local workspaceTested on Ubuntu 16.04InstructionsIn the root folder of your cloned repository build the image by running:$ make build-nvidia-sawyer-simAfter the image is built, run the container:$ make run-nvidia-sawyer-simGazebo and MoveIt! should open with Sawyer in themTo exit the container, typesudo docker stop sawyer-simin a new terminal.Control Sim SawyerOpen a new terminal in the container by running:$ docker exec -it sawyer-sim bashOnce inside the terminal, run the following commands to execute a keyboard
controller:$ cd ~/ros_ws
$ ./intera.sh sim
$ rosrun intera_examples joint_position_keyboard.pyThe following message should appear:Initializing node...
Getting robot state...
[INFO] [1544554222.728405, 33.526000]: Enabling robot...
[INFO] [1544554222.729527, 33.527000]: Robot Enabled
Controlling joints. Press ? for help, Esc to quit.Type ? to get the keys that control sawyer.View the header camera in Sim SawyerPerform the first step from the previous sectionOnce in the container shell, run the following command:rosrun image_view image_view image:=/io/internal_camera/head_camera/image_rawSawyer RobotA dedicated GPU is recommended for rviz and other visualization tools. Currently only NVIDIA GPUs are supported.NVIDIA GPUThis section contains instructions to build the docker image and run the docker
container for the Sawyer robot in the ROS environment using an NVIDIA GPU.PrerequisitesSame as sawyer simulation.InstructionsExport sawyer hostname, sawyer ip address, and workstation ip address.$ export SAWYER_HOSTNAME=__sawyerhostname__  
$ export SAWYER_IP=__sawyerip__ 
$ export WORKSTATION_IP=__workip__In the root folder of your cloned repository build the image by running:$ make build-nvidia-sawyer-robotAfter the image is built, run the container:$ make run-nvidia-sawyer-robotRviz should open with Sawyer in it. Now you can plan and execute trajectories through rviz.To exit the container, typesudo docker stop sawyer-robotin a new terminal.Garage-ROS-InteraTo run Reinforcement Learning algorithms along with the Sawyer robot, we use
thegaragedocker images that include
an extensive library of utilities and primitives for RL experiments.On top of the garage images, we add the layers for ROS and Intera that work
with Python3 (garage runs with Python3), so we're able to communicate with
Sawyer through ROS communication using the convenient libraries for Pythonrospy,intera_interface,moveit_commanderandmoveit_msgs.Under this schema, two docker containers are needed: one for the simulated or
real sawyer, and another with garage-ros-intera. The former creates the ROS
master while the latter subscribes to the ROS topics to control and visualize
what Sawyer is doing through Reinforcement Learning algorithms.PrerequisitesInstallDocker CE. Tested
on version 18.09.0.InstallDocker Compose. Tested
on version 1.23.2.Tested on Ubuntu 16.04. It's recommended to use the versions indicated above
for docker-ce and docker-compose.InstructionsIn the root of the gym-sawyer repository execute:$ make run-nvidia-sawyer-<type>Where type can besim(run simulated Sawyer on Gazebo) orrobot(you're
connected to a real Sawyer).Once the container is up and running (make sure Gazebo is fully initialized if
running simulated Sawyer). Then run:$ make run-garage-<type>-ros RUN_CMD="examples/hello_world_sawyer.py"Where type can be:headless: garage without environment visualization.nvidia: garage with environment visualization using an NVIDIA graphics
card.
If your computer has an NVIDIA GPU, use this image to render the
environments in garage, and the pre-requisites are the same as for the Sawyer
Simulation image.You should see Sawyer moving to neutral position and then waving its arm three
times.The command to execute in the image is specified in the variableRUN_CMD.Run your local repository of garage with ros-interaIf you're working with garage in your local repository and would like to
include your latests changes, follow these instructions.Make sure to run build your docker image for garage first. For
further information, visitgarage.Then rebuild and run the garage-ros image:$ make run-garage-<type>-ros RUN_CMD="..."