Getting list of publishers and subscribers for all ros topics in C++ code
I want to get the list of all subscribers and publishers for a given topic in C++ code.
I know that in Python, you can do rostopic.get_topic_list()
to get this information.
In C++, doing ros::master::getTopics(topics)
would only provide information regarding the list of available topics and their datatypes. But it does not provide information on the nodes publishing and subscribing to it. Is there a C++ API for this?