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

Revision history [back]

I think rosbag Cookbook can do what you want. http://www.ros.org/wiki/rosbag/Cookbook

By section 1.2 of that link you do the following

import rosbag

with rosbag.Bag('input.bag', 'a') as bag:
    from std_msgs.msg import String
    metadata = String(data='my metadata')

    for _, _, t in bag.read_messages():
        break
    bag.write('/metadata', metadata, t - roslib.rostime.Duration(0, 1))

Of course this does require post processing the data which may not be desirable.