Problems with the ROS connection to the Sawyer robot


Recommended Posts


I am giovanni. I am trying to connect with the Sawyer Robot using ROS.

The ROS_HOSTNAME.local of my robot is: 021705CP00067 and my IP is:

First, I'm doing "cd ~/ros_ws". Then, "./" and this show me the following message: "EXITING - Please edit this file, modifying the 'robot_hostname' variable to reflect your Robot's current hostname."

So, to solve that I insert in my console "gedit", but after modify it I cannot connect with the robot.

This is my "./" code:

       # Copyright (c) 2013-2016, Rethink Robotics
       # All rights reserved.
       # This file is to be used in the *root* of your Catkin workspace.
       # This is a convenient script which will set up your ROS environment and
       # should be executed with every new instance of a shell in which you plan on
       # working with Intera.
       # Clear any previously set your_ip/your_hostname
       unset your_ip
       unset your_hostname
       # Note: If ROS_MASTER_URI, ROS_IP, or ROS_HOSTNAME environment variables were
       # previously set (typically in your .bashrc or .bash_profile), those settings
       # will be overwritten by any variables set here.
       # Specify Robot's hostname
       # Set *Either* your computers ip address or hostname. Please note if using
       # your_hostname that this must be resolvable to the Robot.
       # Specify ROS distribution (e.g. indigo, hydro, etc.)
       trap "rm -f -- '${tf}'" EXIT
       # If this file specifies an ip address or hostname - unset any previously set
       # ROS_IP and/or ROS_HOSTNAME.
       # If this file does not specify an ip address or hostname - use the
       # previously specified ROS_IP/ROS_HOSTNAME environment variables.
       if [ -n "${your_ip}" ] || [ -n "${your_hostname}" ]; then
       unset ROS_IP && unset ROS_HOSTNAME
       your_ip="${ROS_IP}" && your_hostname="${ROS_HOSTNAME}"
       # If argument provided, set robot_hostname to argument
       # If argument is sim or local, set robot_hostname to localhost
       if [ -n "${1}" ]; then
       if [[ "${1}" == "sim" ]] || [[ "${1}" == "local" ]]; then
       if [[ -z ${your_ip} || "${your_ip}" == "" ]] && \
       [[ -z ${your_hostname} || "${your_hostname}" == "giovanni.local" ]]; then
       topdir=$(basename $(readlink -f $(dirname ${BASH_SOURCE[0]})))
       cat <<-EOF > ${tf}
       [ -s "\${HOME}"/.bashrc ] && source "\${HOME}"/.bashrc
       [ -s "\${HOME}"/.bash_profile ] && source "\${HOME}"/.bash_profile
       # verify this script is moved out of intera_sdk folder
       if [[ -e "${topdir}/intera_sdk/package.xml" ]]; then
       echo -ne "EXITING - This script must be moved from the intera_sdk folder \
       to the root of your catkin workspace.\n"
       exit 1
       # verify ros_version lowercase
       ros_version="$(tr [A-Z] [a-z] <<< "${ros_version}")"
       # check for ros installation
       if [ ! -d "/opt/ros" ] || [ ! "$(ls -A /opt/ros)" ]; then
       echo "EXITING - No ROS installation found in /opt/ros."
       echo "Is ROS installed?"
       exit 1
       # if set, verify user has modified the robot_hostname
       if [ -n ${robot_hostname} ] && \
       [[ "${robot_hostname}" == "021705CP00067.local" ]]; then
       echo -ne "EXITING - Please edit this file, modifying the \
       'robot_hostname' variable to reflect your Robot's current hostname.\n"
       exit 1
       # if set, verify user has modified their ip address (your_ip)
       if [ -n ${your_ip} ] && [[ "${your_ip}" == "" ]]; then
       echo -ne "EXITING - Please edit this file, modifying the 'your_ip' \
       variable to reflect your current IP address.\n"
       exit 1
       # if set, verify user has modified their computer hostname (your_hostname)
       if [ -n ${your_hostname} ] && \
       [[ "${your_hostname}" == "giovanni.local" ]]; then
       echo -ne "EXITING - Please edit this file, modifying the \
       'your_hostname' variable to reflect your current PC hostname.\n"
       exit 1
       # verify user does not have both their ip *and* hostname set
       if [ -n "${your_ip}" ] && [ -n "${your_hostname}" ]; then
       echo -ne "EXITING - Please edit this file, modifying to specify \
       *EITHER* your_ip or your_hostname.\n"
       exit 1
       # verify that one of your_ip, your_hostname, ROS_IP, or ROS_HOSTNAME is set
       if [ -z "${your_ip}" ] && [ -z "${your_hostname}" ]; then
       echo -ne "EXITING - Please edit this file, modifying to specify \
       your_ip or your_hostname.\n"
       exit 1
       # verify specified ros version is installed
       if [ ! -d "\${ros_setup}" ]; then
       echo -ne "EXITING - Failed to find ROS \${ros_version} installation \
       in \${ros_setup}.\n"
       exit 1
       # verify the ros file exists
       if [ ! -s "\${ros_setup}"/ ]; then
       echo -ne "EXITING - Failed to find the ROS environment script: \
       exit 1
       # verify the user is running this script in the root of the catkin
       # workspace and that the workspace has been compiled.
       if [ ! -s "devel/setup.bash" ]; then
       echo -ne "EXITING - \n1) Please verify that this script is being run \
       in the root of your catkin workspace.\n2) Please verify that your workspace \
       has been built (source /opt/ros/\${ros_version}/; catkin_make).\n\
       3) Run this script again upon completion of your workspace build.\n"
       exit 1
       [ -n "${your_ip}" ] && export ROS_IP="${your_ip}"
       [ -n "${your_hostname}" ] && export ROS_HOSTNAME="${your_hostname}"
       [ -n "${robot_hostname}" ] && \
       export ROS_MASTER_URI="http://${robot_hostname}:11311"
       # source the catkin setup bash script
       source devel/setup.bash
       # setup the bash prompt
       export __ROS_PROMPT=\${__ROS_PROMPT:-0}
       [ \${__ROS_PROMPT} -eq 0 -a -n "\${PROMPT_COMMAND}" ] && \
       __ros_prompt () {
       if [ -n "\${__ORIG_PROMPT_COMMAND}" ]; then
       eval \${__ORIG_PROMPT_COMMAND}
       if ! echo \${PS1} | grep '\[intera' &>/dev/null; then
       export PS1="\[\033[00;33m\][intera - \
       \${ROS_MASTER_URI}]\[\033[00m\] \${PS1}"
       if [ "\${TERM}" != "dumb" ]; then
       export PROMPT_COMMAND=__ros_prompt
       elif ! echo \${PS1} | grep '\[intera' &>/dev/null; then
       export PS1="[intera - \${ROS_MASTER_URI}] \${PS1}"
       ${SHELL} --rcfile ${tf}
       rm -f -- "${tf}"
       trap - EXIT
       # vim: noet

Someone knows what can I do?

Thanks for all


Link to comment
Share on other sites


Quick test you can do:

Try to open a terminal and type:

ping -c 4 <ROBOT HOSTNAME>

see if that returns something other than a "timeout" or "could not resolve" errors

if that's not good try to do the same with

ping -c 4 <ROBOT IP>

if the hostname ping test is giving an error but the ip doesn't it usually means that the DNS in your network is not defined properly.

Link to comment
Share on other sites

You should give the robot static IP address 
Router Config.png


As the network setup figure implies, It is recommended to use the router and set the robot's static address in the same domain to your development PC.

In ur case, it could be (Since you mentioned ur ip address is   Is it static address or DHCP address ?)

If you have any question regarding this, I would like to help you via e-mail ;


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.