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

Revision history [back]

click to hide/show revision 1
initial version

The bag header timestamp is populated by rosbag and is the time that a message was received by the rosbag recorder. I believe these will always be in order, but I am not certain.

If the serialized message contains a timestamp, it is populated by the publisher of that message. ROS and rosbag make no guarantees about the meaning, offset between these timestamps and rosbag timestamps, or even the timestamp validity. All of those things are the responsibility of the publisher.

Some publishers backdate or future-date timestamps, which can cause them to differ from the actual time by a significant amount. I've seen offsets up to 1/2 a second for properly functioning publishers, and I've seen other publishers that just set all timestamps to 0 because their clients don't need the timestamp at all.

The rosbag writers and readers do not look at the header timestamp within the messages, and does not guarantee that messages are ordered by those timestamps. Generally messages from a single publisher are written in the order that they are received, but if there are multiple publishers on a topic, you can easily get header timestamps slightly out order.

It is the client's responsibility to interpret the message header timestamps, and to handle out-of-order timestamps in a way that makes sense for the client.