Difference between revisions of "Gazebo Tutorial"

Jump to: navigation , search
(Simulation)
 
(27 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
 
<div class="content-block">
 
<div class="content-block">
'''Note: This page describes an upcoming feature in Intera 5.2. Gazebo Simulation for Sawyer is not yet released.'''
 
  
[[File:gazebo_logo.png|Gazebo Logo|300px]]<br />
+
[[File:gazebo_logo.png|Gazebo Logo|500px]]<br />
  
'''[http://gazebosim.org/tutorials Please visit the Gazebo Tutorials homepage for more information]'''
+
'''[http://gazebosim.org/tutorials Please visit the Gazebo Tutorials homepage for more information about the Physics simulator]'''
  
 
</div>
 
</div>
Line 18: Line 17:
  
 
== Installation/Prerequisites ==
 
== Installation/Prerequisites ==
*Make sure you have followed the [http://sdk.rethinkrobotics.com/wiki/Workstation_Setup workstation setup tutorial] before beginning this section
+
*Make sure you have followed the [[Workstation Setup]] tutorial before beginning this section. Sawyer Gazebo is '''only''' available for '''Ubuntu 16.04, ROS Kinetic, and Gazebo 7'''.
 
*Ensure the following software packages are installed:
 
*Ensure the following software packages are installed:
  
  
 
<tabs>
 
<tabs>
<tab name="ROS Indigo (Recommended)">
 
<syntaxhighlight lang="bash" enclose="div">
 
$ sudo apt-get install gazebo2 ros-indigo-qt-build ros-indigo-driver-common ros-indigo-gazebo-ros-control ros-indigo-gazebo-ros-pkgs ros-indigo-ros-control ros-indigo-control-toolbox ros-indigo-realtime-tools ros-indigo-ros-controllers ros-indigo-xacro python-wstool ros-indigo-tf-conversions ros-indigo-kdl-parser
 
</syntaxhighlight>
 
</tab>
 
 
<tab name="ROS Kinetic">
 
<tab name="ROS Kinetic">
 
<syntaxhighlight lang="bash" enclose="div">
 
<syntaxhighlight lang="bash" enclose="div">
$ sudo apt-get install gazebo7 ros-kinetic-qt-build ros-kinetic-gazebo-ros-control ros-kinetic-gazebo-ros-pkgs ros-kinetic-ros-control ros-kinetic-control-toolbox ros-kinetic-realtime-tools ros-kinetic-ros-controllers ros-kinetic-xacro python-wstool ros-kinetic-tf-conversions ros-kinetic-kdl-parser
+
$ sudo apt-get install gazebo7 ros-kinetic-qt-build ros-kinetic-gazebo-ros-control ros-kinetic-gazebo-ros-pkgs ros-kinetic-ros-control ros-kinetic-control-toolbox ros-kinetic-realtime-tools ros-kinetic-ros-controllers ros-kinetic-xacro python-wstool ros-kinetic-tf-conversions ros-kinetic-kdl-parser ros-kinetic-sns-ik-lib
</syntaxhighlight>
 
</tab>
 
<tab name="ROS Groovy">
 
<syntaxhighlight lang="bash" enclose="div">
 
$ sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu precise main" > /etc/apt/sources.list.d/gazebo-latest.list'
 
$ wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
 
$ sudo apt-get update
 
$ sudo apt-get install python-wstool python-rosdep ros-groovy-pcl-conversions ros-groovy-control-msgs ros-groovy-cmake-modules ros-groovy-qt-build ros-groovy-moveit-full ros-groovy-driver-common ros-groovy-image-common ros-groovy-rostest gazebo
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 
</tab>
 
</tab>
 
</tabs>
 
</tabs>
  
== Baxter Simulator Installation ==
+
== Sawyer Simulator Installation ==
 
<tabs>
 
<tabs>
<tab name="ROS Indigo (Recommended)">
+
<tab name="ROS Kinetic">
 
*From your catkin workspace where the SDK resides, use wstool to install and update:
 
*From your catkin workspace where the SDK resides, use wstool to install and update:
==== Install baxter_simulator ====
+
==== Install sawyer_simulator ====
 
<syntaxhighlight lang="bash" enclose="div">
 
<syntaxhighlight lang="bash" enclose="div">
 +
$ mkdir -p ~/ros_ws/src
 
$ cd ~/ros_ws/src
 
$ cd ~/ros_ws/src
$ wstool init .
+
$ git clone https://github.com/RethinkRobotics/sawyer_simulator.git
$ wstool merge https://raw.githubusercontent.com/RethinkRobotics/baxter_simulator/master/baxter_simulator.rosinstall
 
$ wstool update
 
</syntaxhighlight>
 
'''IMPORTANT:''' Make sure all simulator repositories update to their proper branch.
 
==== Build Source ====
 
<syntaxhighlight lang="bash" enclose="div">
 
$ source /opt/ros/indigo/setup.bash
 
$ cd ~/ros_ws
 
$ catkin_make
 
</syntaxhighlight>
 
*Use baxter.sh - it has a special hook for sim:
 
<syntaxhighlight lang="bash" enclose="div">
 
$ cp src/baxter/baxter.sh .
 
</syntaxhighlight>
 
* Edit the your_ip value in baxter.sh
 
</tab>
 
<tab name="ROS Kinetic">
 
*From your catkin workspace where the SDK resides, use wstool to install and update:
 
==== Install baxter_simulator ====
 
<syntaxhighlight lang="bash" enclose="div">
 
 
$ cd ~/ros_ws/src
 
$ cd ~/ros_ws/src
 
$ wstool init .
 
$ wstool init .
$ wstool merge https://raw.githubusercontent.com/RethinkRobotics/baxter_simulator/kinetic-devel/baxter_simulator.rosinstall
+
$ wstool merge sawyer_simulator/sawyer_simulator.rosinstall
 
$ wstool update
 
$ wstool update
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 83: Line 50:
 
$ catkin_make
 
$ catkin_make
 
</syntaxhighlight>
 
</syntaxhighlight>
*Use baxter.sh - it has a special hook for sim:
 
<syntaxhighlight lang="bash" enclose="div">
 
$ cp src/baxter/baxter.sh .
 
</syntaxhighlight>
 
* Edit the your_ip value in baxter.sh
 
</tab>
 
<tab name="ROS Indigo apt-get">
 
* First, make sure you have installed ros-indigo-desktop-full: http://wiki.ros.org/indigo/Installation/Ubuntu
 
==== Install baxter_simulator ====
 
<syntaxhighlight lang="bash" enclose="div">
 
$ sudo apt-get install ros-indigo-baxter-simulator
 
</syntaxhighlight>
 
*Use baxter.sh - it has a special hook for sim:
 
<syntaxhighlight lang="bash" enclose="div">
 
$ cd ~/ros_ws
 
$ wget https://raw.githubusercontent.com/RethinkRobotics/baxter/master/baxter.sh
 
</syntaxhighlight>
 
* Edit the your_ip value in baxter.sh
 
</tab>
 
<tab name="ROS Groovy">
 
*From your catkin workspace where the SDK resides, use wstool to install and update:
 
 
<syntaxhighlight lang="bash" enclose="div">
 
$ cd ~/ros_ws/src
 
$ wstool merge https://raw.githubusercontent.com/RethinkRobotics/baxter_simulator/release-0.8.1/baxter_simulator.rosinstall
 
$ cd ~/ros_ws/src
 
$ wstool init .
 
$ wstool merge baxter_simulator/baxter_simulator.rosinstall
 
$ wstool update
 
</syntaxhighlight>
 
'''IMPORTANT:''' Make sure all simulator repositories update to their proper branch.
 
*Build
 
<syntaxhighlight lang="bash" enclose="div">
 
$ source /opt/ros/groovy/setup.bash
 
$ cd ~/ros_ws
 
$ catkin_make
 
$ catkin_make install
 
</syntaxhighlight>
 
*Use baxter.sh - it has a special hook for sim:
 
<syntaxhighlight lang="bash" enclose="div">
 
$ cp src/baxter/baxter.sh .
 
</syntaxhighlight>
 
* Edit the your_ip value in baxter.sh
 
 
</tab>
 
</tab>
 
 
</tabs>
 
</tabs>
 
=== Simulation ===
 
=== Simulation ===
*Run the baxter shell script with sim specified:
+
*The intera.sh shell has a special hook of *sim* for Simulation. Run the Intera shell script with sim specified:
 
<syntaxhighlight lang="bash" enclose="div">
 
<syntaxhighlight lang="bash" enclose="div">
$ ./baxter.sh sim
+
$ ./intera.sh sim
 
</syntaxhighlight>
 
</syntaxhighlight>
 
*Start simulation with controllers:
 
*Start simulation with controllers:
 
<syntaxhighlight lang="bash" enclose="div">
 
<syntaxhighlight lang="bash" enclose="div">
$ roslaunch baxter_gazebo baxter_world.launch
+
$ roslaunch sawyer_gazebo sawyer_world.launch
</syntaxhighlight>
 
 
 
You should wait for the following three lines before the simulator is truly running:
 
[ INFO] [1400513321.531488283, 34.216000000]: Simulator is loaded and started successfully
 
[ INFO] [1400513321.535040726, 34.219000000]: Robot is disabled
 
[ INFO] [1400513321.535125386, 34.220000000]: Gravity compensation was turned off
 
By default the robot would be in disabled state. To enable, run the [[Enable_Robot_Tool|enable_robot]] script from the baxter_tools package. To start and switch the controllers, use the JointCommand topic as [[API_Reference#Arm_Joints_Control_2|documented in the Baxter SDK]].
 
*Optional: Test/tune the velocity controllers or position controllers using a RQT dashboard GUI. Make sure you are in the right joint command mode when using these:
 
<syntaxhighlight lang="bash" enclose="div">
 
$ roslaunch baxter_sim_hardware baxter_sdk_position_rqt.launch
 
</syntaxhighlight>
 
or
 
<syntaxhighlight lang="bash" enclose="div">
 
$ roslaunch baxter_sim_hardware baxter_sdk_velocity_rqt.launch
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 177: Line 86:
  
 
== Run SDK Examples ==
 
== Run SDK Examples ==
*Start Wobbler example:
+
*Start Joint Torque Springs example:
 
<syntaxhighlight lang="bash" enclose="div">
 
<syntaxhighlight lang="bash" enclose="div">
$ ./baxter.sh sim
+
$ ./intera.sh sim
$ rosrun baxter_examples joint_velocity_wobbler.py
+
$ roslaunch sawyer_gazebo sawyer_world.launch
 +
*in a new terminal*
 +
$ ./intera.sh sim
 +
$ rosrun intera_examples joint_torque_springs.py
 
</syntaxhighlight>
 
</syntaxhighlight>
*Start keyboard joint position example:
+
 
 +
*Or, Start Simulated Pick and Place example:
 
<syntaxhighlight lang="bash" enclose="div">
 
<syntaxhighlight lang="bash" enclose="div">
$ ./baxter.sh sim
+
$ ./intera.sh sim
$ rosrun baxter_examples joint_position_keyboard.py
+
$ roslaunch sawyer_sim_examples sawyer_pick_and_place_demo.launch
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 
For additional information on the interfaces that are implemented with this release, visit the [[API_Reference#tab=Simulator_API|Simulator API]] page.
 
For additional information on the interfaces that are implemented with this release, visit the [[API_Reference#tab=Simulator_API|Simulator API]] page.
  
 
==Troubleshooting==
 
==Troubleshooting==
*'''Please refer to the troubleshooting page [[Gazebo Troubleshooting]] '''
+
*'''Please refer to the troubleshooting page Gazebo Troubleshooting '''
  
 
----
 
----

Latest revision as of 16:29, 14 March 2018

This tutorial describes how to use Sawyer with Gazebo the standard Physics Simulator for ROS.

Installation/Prerequisites

  • Make sure you have followed the Workstation Setup tutorial before beginning this section. Sawyer Gazebo is only available for Ubuntu 16.04, ROS Kinetic, and Gazebo 7.
  • Ensure the following software packages are installed:


$ sudo apt-get install gazebo7 ros-kinetic-qt-build ros-kinetic-gazebo-ros-control ros-kinetic-gazebo-ros-pkgs ros-kinetic-ros-control ros-kinetic-control-toolbox ros-kinetic-realtime-tools ros-kinetic-ros-controllers ros-kinetic-xacro python-wstool ros-kinetic-tf-conversions ros-kinetic-kdl-parser ros-kinetic-sns-ik-lib

Sawyer Simulator Installation

  • From your catkin workspace where the SDK resides, use wstool to install and update:

Install sawyer_simulator

$ mkdir -p ~/ros_ws/src
$ cd ~/ros_ws/src
$ git clone https://github.com/RethinkRobotics/sawyer_simulator.git
$ cd ~/ros_ws/src
$ wstool init .
$ wstool merge sawyer_simulator/sawyer_simulator.rosinstall
$ wstool update

IMPORTANT: Make sure all simulator repositories update to their proper branch.

Build Source

$ source /opt/ros/kinetic/setup.bash
$ cd ~/ros_ws
$ catkin_make

Simulation

  • The intera.sh shell has a special hook of *sim* for Simulation. Run the Intera shell script with sim specified:
$ ./intera.sh sim
  • Start simulation with controllers:
$ roslaunch sawyer_gazebo sawyer_world.launch

Smoke Test

Check if the simulator was installed and launched successfully by typing the following commands:

$ rosnode list

This should list the nodes as here.

$ rostopic list

This should list the topics as here.

$ rostopic echo /robot/state

By default, the following messages should be displayed at 100 HZ.

enabled: False
stopped: False
error: False
estop_button: 0
estop_source: 0
---

Run SDK Examples

  • Start Joint Torque Springs example:
$ ./intera.sh sim
$ roslaunch sawyer_gazebo sawyer_world.launch
*in a new terminal*
$ ./intera.sh sim
$ rosrun intera_examples joint_torque_springs.py
  • Or, Start Simulated Pick and Place example:
$ ./intera.sh sim
$ roslaunch sawyer_sim_examples sawyer_pick_and_place_demo.launch

For additional information on the interfaces that are implemented with this release, visit the Simulator API page.

Troubleshooting

  • Please refer to the troubleshooting page Gazebo Troubleshooting