Ask Your Question
1

How to check if network connection or remote ROS Master is down?

asked 2018-08-21 09:43:35 -0600

pavel92 gravatar image

updated 2018-08-21 09:47:29 -0600

I am running ROS (Kinetic on Ubuntu 16.04) on two machines (desktop pc and Jackal pc) and the Jackal pc is set as the ROS Master. The both machines are connected over a wireless network. I am writing a python node which is supposed to run on my machine and in case of being disconnected from the wifi to perform some action. To keep it simple for now, this action can be just a ROS warning. So my question is:

What is the best way in ROS to check/detect in the node code if the connection is down (i.e. my machine has disconnected from the network)?

When the connection goes down, the nodes that are run on my machine (in sourced terminals) are waiting for the master which is on the Jackal to be reconnected so that the publishers can continue to publish the messages. In this case when the connection is down if I run rostopic list in a sourced terminal there is no output at all. The same goes for any rosrun/roslaunch commands.
I am sure that there is also a way to check if there is a connection to the ROS Master but I could not find a working solution. I can always write my own timeout method but I would like to know if an proper way to do this already exists.

edit retag flag offensive close merge delete

Comments

If this definitely isn't a 'proper' method but you could use a system call to ifconfig <NIC_name> to find out if your wi-fi connection is down very quickly.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2018-08-21 11:32:17 -0600 )edit

An alternative to checking (but something that might actually be better): a multimaster setup.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-22 02:20:14 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-22 02:17:31 -0600

Reamees gravatar image

updated 2018-08-22 02:22:50 -0600

Seems like ros::master::check () would be one way to go.

API

techno74 asking and answering a similar question.

A similar function for python is mentioned in the previous question.

rosgraph.is_master_online()

edit flag offensive delete link more

Comments

I tried the rosgraph.is_master_online() and it works without a problem when there is a network connection. The problem still occurs when the network goes down as the node is in limbo state. In this case rosgraph blocks the node and fails to check for the master

pavel92 gravatar imagepavel92 ( 2018-08-22 03:14:39 -0600 )edit

having same issue as pavel92, every method which somehow relies on rosgraph, somehow blocks. it s as though resorption until reconnecting

Ariel_GLR gravatar imageAriel_GLR ( 2019-04-11 03:24:26 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-08-21 09:43:35 -0600

Seen: 745 times

Last updated: Aug 22 '18