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

Revision history [back]

The rosbag_storage package described here allows you to access and modify the contents of a bag file without playing it back as you would normally have to. Using this you can look through all of the messages in a bag file and write messages into a bag file too.

However you cannot add a field into a message, the structure of messages is fixed and they can only contain the fields they are defined with. Some message types however include a normal type and 'Stamped' type which is the same message with an additional Header.

For example if your bag file contains geometry_msgs/pose messages then you could read these and create geometry_msgs/PoseStamped with the additional frame_id information in the header and write them back to the file. Only some messages have a stamped version though.

Hope this helps.