ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Action Server timeout across systems

asked 2016-09-11 17:15:43 -0500

anonymous user

Anonymous

I am having trouble with actionlib.SimpleActionClient wait_for_server timing out when the client and server are on different systems and I could use help understanding why. In this case, roscore and the action server is running on a Raspberry Pi and the client is running on an Ubuntu VM. Both are running Indigo. I have a simple example that runs fine when the client and server run on the same computer (the Raspberry Pi). However when I run roscore and the action server on the Raspberry Pi and I run these commands on the Ubuntu client side:

  • rosnode list correctly lists the server node
  • rostopic list correctly lists the topics
  • rosnode ping ping_action_server shows repeated successful pings of about 20 msecs

However, when I run the following client code it fails to connect...

import sys
import rospy
import actionlib

from inmoov.msg import PingAction, PingGoal, PingResult

def onShutdown():
    rospy.loginfo("Shutting down")

try:  
    rospy.init_node('ping_client', log_level=rospy.DEBUG)
    rospy.on_shutdown(onShutdown)
    client = actionlib.SimpleActionClient('ping', PingAction)
    rospy.loginfo("Waiting for ping action server...")
    finished = client.wait_for_server(timeout = rospy.Duration(10.0))
    if(finished is False): 
        rospy.logerr("Ping action server timed out")
    else:
        rospy.loginfo("Ping action server found")

except:
    print("An exception was encountered")
    e = sys.exc_info()[0]
    print str(e)

The output is:

[DEBUG] [WallTime: 1473631183.986657] init_node, name[/ping_client], pid[7947]
[DEBUG] [WallTime: 1473631183.987061] binding to 0.0.0.0 0
[DEBUG] [WallTime: 1473631183.987256] bound to 0.0.0.0 35061
[DEBUG] [WallTime: 1473631183.987703] ... service URL is rosrpc://raspberrypi:35061
[DEBUG] [WallTime: 1473631183.987884] [/ping_client/get_loggers]: new Service instance
[DEBUG] [WallTime: 1473631184.003141] ... service URL is rosrpc://raspberrypi:35061
[DEBUG] [WallTime: 1473631184.003397] [/ping_client/set_logger_level]: new Service instance
[INFO] [WallTime: 1473631184.130352] Waiting for ping action server...
[DEBUG] [WallTime: 1473631184.131371] connecting to raspberrypi 52197
[DEBUG] [WallTime: 1473631184.131768] connecting to raspberrypi 52197
[DEBUG] [WallTime: 1473631184.152471] connecting to raspberrypi 52197
[ERROR] [WallTime: 1473631194.139802] Ping action server timed out
[INFO] [WallTime: 1473631194.140166] Shutting down
[DEBUG] [WallTime: 1473631194.192350] connecting to raspberrypi 52197
[DEBUG] [WallTime: 1473631194.193241] connecting to raspberrypi 52197

Any ideas would be appreciated. If it matters, I have a ROS publisher that runs on the Ubuntu VM and a ROS Subscriber on the Raspberry Pi that successfully receives the published messages. The Raspberry Pi has a static IP and the Ubuntu VM has an entry in /etc/hosts to map the static IP to the host name "raspberrypi".

Here are the Ubuntu environment settings:

mike@badmonkey:~$ printenv | grep ROS
ROS_ROOT=/opt/ros/indigo/share/ros
ROS_PACKAGE_PATH=/home/mike/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
ROS_MASTER_URI=http://raspberrypi:11311
ROS_HOSTNAME=raspberrypi
ROSLISP_PACKAGE_DIRECTORIES=/home/mike/catkin_ws/devel/share/common-lisp
ROS_DISTRO=indigo
ROS_LANG_DISABLE=genlisp
ROS_ETC_DIR=/opt/ros/indigo/etc/ros
edit retag flag offensive close merge delete

Comments

Your hostname is badmonkey but your ROS_HOSTNAME is raspberrypi. Can you ping a node that is running on your Ubuntu machine from your raspberry pi?

ahendrix gravatar image ahendrix  ( 2016-09-11 21:19:06 -0500 )edit

No, rosnode list includes the node, but I get this...

pi@raspberrypi:~ $ rosnode ping leap_motion_publisher
rosnode: node is [/leap_motion_publisher]
pinging /leap_motion_publisher with a timeout of 3.0s
ERROR: connection refused to [http://raspberrypi:45057/]
anonymous userAnonymous ( 2016-09-12 18:20:46 -0500 )edit

Your hostname is badmonkey but your ROS_HOSTNAME is raspberrypi, so any nodes running on your Ubuntu machine are advertising the wrong host name.

ahendrix gravatar image ahendrix  ( 2016-09-12 20:43:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-13 07:05:38 -0500

anonymous user

Anonymous

As @ahendrix pointed out in the question comments, I was confused about ROS_HOSTNAME. I had assumed that was the hostname of the node running roscore. When I changed the ROS_HOSTNAME to properly reflect the hostname of the Ubuntu VM to be badmonkey instead of raspberrypi, the problem was resolved.

Thank you for your help!

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2016-09-11 17:12:08 -0500

Seen: 1,584 times

Last updated: Sep 13 '16