This page will show you how to communicate with the robot, moving the arms, and allowing him to say "Hello!" to your lab. 


Contents


Required Hardware


Setup ROS Environment


Upon compilation of our catkin workspace, the generated devel folder in the root of our catkin workspace will contain a setup script which informs the ROS environment of our compiled catkin workspace and the packages therein. The root of the catkin workspace that we created is located at ~/ros_ws.


# Move to root of our catkin workspace
$ cd ~/ros_ws


If the devel folder is not available in the root of your catkin_ws, your catkin/ROS workspace (~/ros_ws) is not yet compiled:

 

ROS Noetic


$ source /opt/ros/noetic/setup.bash
$ catkin_make

ROS Melodic (Recommended)
$ source /opt/ros/melodic/setup.bash
$ catkin_make

ROS Kinetic (Deprecated)
$ source /opt/ros/kinetic/setup.bash
$ catkin_make

ROS Indigo (Deprecated)
$ source /opt/ros/indigo/setup.bash
$ catkin_make

 

Source ROS Environment Setup Script


Intera.sh ROS Environment Setup

# Source intera.sh script

$ ./intera.sh


Verify ROS Connectivity


In this step, we will verify communication to and from Sawyer and our development workstation.


Verify ROS Master Ping


The development workstation must be able to resolve the ROS Master (running on Sawyer). This is defined by the ROS_MASTER_URI which has been set. This ROS_MASTER_URI is typically the ROBOT_HOSTNAME configured (your Sawyer Controller Box Serial Number by default).


# Identify the ROS Master location
$ env | grep ROS_MASTER_URI

 

The result (example): ROS_MASTER_URI=http://011303P0017.local:11311 011303P0017.local in this case is the location of our ROS Master. The development PC must be able to resolve and communicate with this Master.

Verify ability ping our ROS Master:


$ ping <our ROS Master>
# Example
$ ping 011303P0017.local

 

View Available ROS Topics


Now that we have identified our ROS Master is available on our network, lets view the available rostopics:


$ rostopic list


Echo a ROS Topic


Now that we have seen the available rostopics, and have verified communication to and from Sawyer and our development PC, we can connect to and echo the contents being published to a chosen topic:

Double check that our workspace is still configured correctly:

intera.sh ROS Environment Setup


$ cd ~/ros_ws
$ ./intera.sh

 

Standard bashrc ROS Environment Setup


$ cd ~/ros_ws
$ source devel/setup.bash

 

Echo Sawyer's joint_states


$ rostopic echo /robot/joint_states

 

You should see a continuous stream of Sawyer's joint names with measured positions, velocities and torques.

All is well! You have successfully setup communication between your development PC and Sawyer.


Enable the Robot


A fundamental tool for use when working with Sawyer, the enable_robot tool, provided in the intera_interface SDK package, allows for enabling/disabling/resetting/stopping the robot. While Sawyer is enabled by default when it boots, it is possible to enable it from the commandline which is required after an E-STOP press. Sawyer must be enabled in order to actively command any of the motors.

Enable the robot:


$ rosrun intera_interface enable_robot.py -e


Sawyer will now be enabled (if it wasn't already). The joints will be powered, and Sawyer will hold his current joint positions with in a position control loop.


 Enters Sawyer's arm into "Zero-G" mode. The position control loop will be released with solely gravity compensation enabled. This allows for intuitive hand-over-hand guidance of the limb throughout the workspace.


Run an Example Program


A number of Sawyer example programs are provided which use the intera_interface package which contains Python modules for Sawyer Research Robot development.

Run an example program:


$ rosrun intera_examples joint_torque_springs.py

 

This example will simply move the arms to a neutral position, enter into velocity control mode, moving each joint through a random sinusoidal motion. More about this example on the Joint Torque Springs Example Page.


Interactively Program Sawyer


Time to program Sawyer! We will now use an interactive Python Shell to programmatically move the arms.

Make sure Sawyer is enabled:


$ rosrun intera_interface enable_robot.py -e

 

Start an Interactive Python Shell:


$ python

# Import the necessary Python modules

# rospy - ROS Python API
>>> import rospy

# intera_interface - Sawyer Python API
>>> import intera_interface

# initialize our ROS node, registering it with the Master
>>> rospy.init_node('Hello_Sawyer')

# create an instance of intera_interface's Limb class
>>> limb = intera_interface.Limb('right')

# get the right limb's current joint angles
>>> angles = limb.joint_angles()

# print the current joint angles
>>> print angles

# move to neutral pose
>>> limb.move_to_neutral()

# get the right limb's current joint angles now that it is in neutral
>>> angles = limb.joint_angles()

# print the current joint angles again
>>> print angles

# reassign new joint angles (all zeros) which we will later command to the limb
>>> angles['right_j0']=0.0
>>> angles['right_j1']=0.0
>>> angles['right_j2']=0.0
>>> angles['right_j3']=0.0
>>> angles['right_j4']=0.0
>>> angles['right_j5']=0.0
>>> angles['right_j6']=0.0

# print the joint angle command
>>> print angles

# move the right arm to those joint angles
>>> limb.move_to_joint_positions(angles)

# Sawyer wants to say hello, let's wave the arm

# store the first wave position
>>> wave_1 = {'right_j6': -1.5126, 'right_j5': -0.3438, 'right_j4': 1.5126, 'right_j3': -1.3833, 'right_j2': 0.03726, 'right_j1': 0.3526, 'right_j0': -0.4259}

# store the second wave position
>>> wave_2 = {'right_j6': -1.5101, 'right_j5': -0.3806, 'right_j4': 1.5103, 'right_j3': -1.4038, 'right_j2': -0.2609, 'right_j1': 0.3940, 'right_j0': -0.4281}


# wave three times
>>> for _move in range(3):
... limb.move_to_joint_positions(wave_1)
... rospy.sleep(0.5)
... limb.move_to_joint_positions(wave_2)
... rospy.sleep(0.5)


# quit
>>> quit()


Congratulations! You have successfully completed the installation tutorials!