ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
rosbag::Bag input("input.bag");
rosbag::Bag output("output.bag", rosbag::bagmode::Write);
rosbag::View topic_view(input, rosbag::TopicQuery("topic_to_reqrite"));
BOOST_FOREACH(rosbag::MessageInstance const message, topic_view) {
output.write(message.getTopic(), message.getTime(), message, message.getConnectionHeader());
}
For more information on the API functions, have a look at the API docs.
2 | No.2 Revision |
This code should work:
rosbag::Bag input("input.bag");
rosbag::Bag output("output.bag", rosbag::bagmode::Write);
rosbag::View topic_view(input, rosbag::TopicQuery("topic_to_reqrite"));
BOOST_FOREACH(rosbag::MessageInstance const message, topic_view) {
output.write(message.getTopic(), message.getTime(), message, message.getConnectionHeader());
}
For more information on the API functions, have a look at the API docs.