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

Determine if another rosnode is subscribing to published topic?

asked 2012-10-17 06:20:22 -0500

PerkinsJames gravatar image

Is there a way for a publisher to check if another node is online and/or if the other node has established subscriptions to topics? (C++). I want to ensure that I don't send a configuration command if the subscriber has not yet subscribed.

I've seen this before that you can do this, but I don’t remember how.

Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2012-10-17 07:11:56 -0500

dornhege gravatar image

updated 2012-10-17 07:12:32 -0500

pub.getNumSubscribers() > 0

Depending on your application, consider a latched publisher.

edit flag offensive delete link more
0

answered 2012-12-11 23:14:57 -0500

Benoit Larochelle gravatar image

If you cannot use a latch, this question is related: http://answers.ros.org/question/11167/how-do-i-publish-exactly-one-message/

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-10-17 06:20:22 -0500

Seen: 2,449 times

Last updated: Dec 11 '12