ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I'm not sure that's the appropriate way to use the rosbag API to read messages from one bag file and write them to another.
The last time I did this, my code looked something like:
rosbag::Bag output("output.bag", rosbag::bagmode::Write);
rosbag::Bag input("input.bag");
rosbag::View view(input, rosbag::TopicQuery("numbers"));
BOOST_FOREACH(rosbag::MessageInstance const m, view)
{
output.write(m.getTopic(), m.getTime(), m, m.getConnectionHeader());
}
output.close();
input.close();