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

How to handle unreliable connection with rospy?

asked 2014-05-09 03:18:54 -0600

gudjon gravatar image

Im running ROS on a AUV that connects wirelessly to a pilot computer. The AUV runs roscore and the pilot computer runs a few nodes to send commands and display its state. When the AUV loses connection everything stops working. If I kill all nodes on the pilot computer before the connection is lost it works fine so Im guessing this is because it gets stuck trying to publish to the pilot computer.

Is there a way to gracefully handle a lost connection between nodes using rospy?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-05-09 06:40:03 -0600

ahendrix gravatar image

By default, rospy publishers are blocking, and a blocking publish call won't return until the underlying TCP socket succeeds or times out. You can change this by specifying the queue size to the rospy publisher.

The original bug report for this is ros_comm #169 and the fix is released into Hydro and later releases.

edit flag offensive delete link more


Thanks, adding queue_size=1 seams to fix my problem in most cases. I'm still having problems with one node that uses action lib but I think I can work around that.

gudjon gravatar image gudjon  ( 2014-05-14 11:46:08 -0600 )edit

If the rospy implementation of actionlib doesn't support setting the queue size yet, you should probably open a bug letting them know about it.

ahendrix gravatar image ahendrix  ( 2014-05-14 11:54:33 -0600 )edit

Question Tools

1 follower


Asked: 2014-05-09 03:18:54 -0600

Seen: 211 times

Last updated: May 09 '14