0
$\begingroup$

Rosanswers logo

Hi. I've a c++ thread that is checking every x seconds if some robots are active. For that, every robot publishes a topic (/robot1/status). So if the robot is publishing, I know that it is alive.

For that reason, my thread subscribes to all these "status" topics. Is it possible to have a common callback for all the topics or I need one function to every one topic?

Thanks.


Originally posted by Verane on ROS Answers with karma: 25 on 2013-06-26

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Yes, that is possible. Also have a look at this answer if you want your callback to have a custom parameter, to know which topic (/robot) is the source.


Edit:

You could use only one topic and let every robot send messages with a unique id to it.


Originally posted by Ben_S with karma: 2510 on 2013-06-26

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Verane on 2013-06-26:
Thanks. I'll try with std::bind instead of boost::bind.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.