How to exit on failure to contact master

asked 2016-11-04 12:41:00 -0600


I would like my roscpp node to fail with an exit code if the ROS master cannot be contacted, possibly after a certain number of retries. I have not found any possibility to do so in the API.

What I found was the possibility to do

ros::init(argc, argv, "something");
if(!ros::master::check()) exit(1);

However, if I start the node with a parameter, e.g., rosnode mypackge mynode _param:=value, I am stuck in the loop

[ERROR] [1478281100.140400779]: [setParam] Failed to contact master at [localhost:11311]. Retrying...

Any ideas?

edit retag flag offensive close merge delete