0
$\begingroup$

Rosanswers logo

Python code API for reading rosbag files has read_messages method, that returns a tuple with the topic name, msg and time. What is the difference between msg.header.stamp and time?

Is it that msg.header.stamp is the timestamp created in the driver before publishing the msg, while time is the timestamp when that msg got recorded in the bag file, i.e. received by the rosbag record's subscriber?

Sorry, but I didn't find no clue in the documentation and I've not been able to guess it from the sources.

Thanks.


Originally posted by Enrique on ROS Answers with karma: 834 on 2012-03-12

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I think that you are correct in your assumption.

rosbag also records the time of incoming messages so that it can be played back in proper order. It also has to record the time of incoming messages for message types that do not include the header field.

You have to remember that the msg.header.stamp field can be populated with whatever you want. In the case of a camera, it may be when the frame is recorded, or in the case of a laser, when the particular scan was recorded.

There may be additional steps (say an image pipeline), between the original time that the camera frame is captured, and when rosbag gets the message to be recorded. In this case, the data in the image represents the physical world at a certain time (msg.header.stamp), but has been received at a different time (time).


Originally posted by mjcarroll with karma: 6414 on 2012-03-12

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Enrique on 2012-03-12:
It sounds coherent, I agree. BTW, I'm trying to detect msg dropping. The seq number is OK (no one missed). But I've detect msgs with delays greater (x4) than the sampling period set. Only a few though. So, header.stamp is the one to check; time is not useful for this, isn't it?

Comment by mjcarroll on 2012-03-12:
I think that in most cases, if the message has a header.stamp field, then that's the one to check. The time field should probably only be used in the case where a message doesn't have that, or diagnosing latency problems.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.