Ask Your Question
1

Bag file: read_messages tuple timestamp

asked 2012-03-12 06:39:30 -0500

Enrique gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-03-12 07:41:34 -0500

mjcarroll gravatar image

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).

edit flag offensive delete link more

Comments

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?

Enrique gravatar image Enrique  ( 2012-03-12 08:38:45 -0500 )edit

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.

mjcarroll gravatar image mjcarroll  ( 2012-03-12 09:14:06 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-03-12 06:39:30 -0500

Seen: 1,561 times

Last updated: Mar 12 '12