ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can also try this code :)
ros::master::V_TopicInfo master_topics;
ros::master::getTopics(master_topics);
for (ros::master::V_TopicInfo::iterator it = master_topics.begin() ; it != master_topics.end(); it++) {
const ros::master::TopicInfo& info = *it;
std::cout << "Topic : " << it - master_topics.begin() << ": " << info.name << " -> " << info.datatype << std::endl;
}
2 | No.2 Revision |
You can also try this code :)
ros::master::V_TopicInfo master_topics;
ros::master::getTopics(master_topics);
for (ros::master::V_TopicInfo::iterator it = master_topics.begin() ; it != master_topics.end(); it++) {
const ros::master::TopicInfo& info = *it;
std::cout << "Topic : " << it - master_topics.begin() << ": " << info.name << " -> " << info.datatype << std::endl;
}
See also here: https://answers.ros.org/question/108176/how-to-list-all-topicsservices-that-are-known-by-the-server-with-roscpp/
However if someone knows how to do that with rospy let me know ! :)