• Diff for "Bags/Format"
Differences between revisions 5 and 6
Revision 5 as of 2009-04-30 18:37:52
Size: 2179
Editor: BrianGerkey
Comment:
Revision 6 as of 2009-04-30 18:57:15
Size: 3522
Editor: BrianGerkey
Comment:
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
= Version 1.2 =
== Usage ==
The 1.2 bag format is used by ROS releases in the 0.5.x line. The primary difference compared to 1.1 is that 1.2 includes the full text of each message definition, instead of just the type and md5sum. This information was added to improve bag longevity by allowing for tools that manipulate a bag after the message types stored within have been changed, moved, or deleted.

== Format ==
Line 22: Line 28:
The 1.1 bag format The 1.1 bag format was the first format that was officially released. It is used by all ROS releases in the 0.4.x line. It appears to have been in use in the repository since at least r2592.
Line 41: Line 47:
Fields:
Line 43: Line 48:
||topic||The topic on which the message arrived||character string||variable length, newline-terminated||
||md5sum||The md5sum for the message type||character string||variable length (should be 32 bytes), newline-terminated||
||type||The message type||character string||variable length, newline-terminated||
||time_sec||Time at which the message was received, integral seconds part||little-endian integer||4 bytes||
||time_nsec||Time at which the message was received, integral nanoseconds part||little-endian integer||4 bytes||
||'''topic'''||topic on which the message arrived||character string||variable length, newline-terminated||
||'''md5sum'''||md5sum for the message type||character string||variable length (should be 32 bytes), newline-terminated||
||'''type'''||message type||character string||variable length, newline-terminated||
||'''time_sec'''||time at which the message was received, integral seconds part||little-endian integer||4 bytes||
||'''time_nsec'''||time at which the message was received, integral nanoseconds part||little-endian integer||4 bytes||
||'''length'''||Length, in bytes, of the data to follow||little-endian integer||4 bytes||
||'''data'''||The serialized message data||ROS serialization format||'''length''' bytes||
Line 49: Line 56:
== Example ==
A 1.1 bag file might start like this (showing the version string and two messages):
{{{
#ROSRECORD V1.1
/mechanism_state
2fc442e85b325b48a5c28bfff1aec3e8
robot_msgs/MechanismState
<binary data here, which can include any bytes, including nulls and newlines>/tf_message
bf97565a3af47c603375c0814456d7db
tf/tfMessage
<binary data here, which can include any bytes, including nulls and newlines>}}}
Line 51: Line 69:
TODO The 1.0 bag format was never officially released.

'''TODO:''' describe the format, just in case people have very old bags lying around.

This page describes the ROS log format, which allows you to store ROS messages in files. Files using this format are called bags, and have the file extension .bag. Bags are recorded, played back, and generally manipulated by tools in the ["rosrecord"] package, including rosrecord, rosplay, and rosrebag.

TableOfContents(2)

Versioning

The ROS log format has changed over time. This document describes all formats that have ever been officially supported.

There is no guarantee of compatibility between different versions. Newly created bags are always recorded at the current version. While we make every effort to support playback of older bags, in some cases user intervention may be required to update an old bag for playback.

All bags begin with a newline-terminated string of the form:

#ROSRECORD VX.Y

Where X and Y are the major and minor version numbers. E.g., for version 1.1, the first line of the bag reads:

#ROSRECORD V1.1

After this line, the details vary by version.

Version 1.2

Usage

The 1.2 bag format is used by ROS releases in the 0.5.x line. The primary difference compared to 1.1 is that 1.2 includes the full text of each message definition, instead of just the type and md5sum. This information was added to improve bag longevity by allowing for tools that manipulate a bag after the message types stored within have been changed, moved, or deleted.

Format

Version 1.1

Usage

The 1.1 bag format was the first format that was officially released. It is used by all ROS releases in the 0.4.x line. It appears to have been in use in the repository since at least r2592.

Format

Following the version line, messages are written, one after the other. There is no other data stored to the file:

#ROSRECORD V1.1
<message 1>
<message 2>
....
<message N>

Each message has the following format:

<topic>
<md5sum>
<type>
<time_sec><time_nsec><length><data>

Note that the first 3 fields are newline-terminated. The last 4 fields, including data, are not newline-terminated.

Name

Description

Format

Length

topic

topic on which the message arrived

character string

variable length, newline-terminated

md5sum

md5sum for the message type

character string

variable length (should be 32 bytes), newline-terminated

type

message type

character string

variable length, newline-terminated

time_sec

time at which the message was received, integral seconds part

little-endian integer

4 bytes

time_nsec

time at which the message was received, integral nanoseconds part

little-endian integer

4 bytes

length

Length, in bytes, of the data to follow

little-endian integer

4 bytes

data

The serialized message data

ROS serialization format

length bytes

Example

A 1.1 bag file might start like this (showing the version string and two messages):

#ROSRECORD V1.1
/mechanism_state
2fc442e85b325b48a5c28bfff1aec3e8
robot_msgs/MechanismState
<binary data here, which can include any bytes, including nulls and newlines>/tf_message
bf97565a3af47c603375c0814456d7db
tf/tfMessage
<binary data here, which can include any bytes, including nulls and newlines>

Version 1.0

The 1.0 bag format was never officially released.

TODO: describe the format, just in case people have very old bags lying around.

Wiki: Bags/Format (last edited 2016-05-01 19:14:26 by RogerErens)