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

Revision history [back]

You can use rosbag::View::getConnectionInfo.

rosbag::Bag bag("foo.bag");
rosbag::View view(bag);
std::vector<const rosbag::ConnectionInfo *> connection_infos = view.getConnectionInfo();
std::set<std::string> topics;

BOOST_FOREACH(const rosbag::ConnectionInfo *info, connection_infos) {
  if( !topics.find(info->topic) ) {
    topics.insert(info->topic);
  }
}