Semantics of `%time` timestamp in `rostopic echo -p` from bagfile?
When I print the topic data using rostopic echo -p -b filename.bag /topic_name
, there are two timestamps in the output. One comes from the header of the message (third column: field.header.stamp
), one comes from somewhere else (first column: %time
). Both have slightly different values, e.g.
%time
: 1552649896239792539 (2019-03-15 11:38:16.239793),field.header.stamp
: 1552649894321638000 (2019-03-15 11:38:14.321638)
I didn't find documentation about the first timestamp %time
. Is it assigned by rosbag to reflect the time of recording?
In this case, this would indicate that the message was recorded almost two seconds after the timestamp in the header indicates. Would it be reasonable to make inferences about the latency on the topic like this?
You have mostly answered the question already. The first time value is when rosbag received the message. About making inferences about latency based on the time differences. There are other factors you need to account for. For example if you are using more than one computer and are not synchronizing the clocks then you can get quite a big time difference from that. So I would say if you want to profile latency, then do that with tools designed to do that and once you know what the values are with the other factors taken into account you could make some assumptions based on the difference in the timestamps. If I would see a time difference of 2 seconds my first assumption would be that the clock on the publishing computer is 2s behind the recording computer, not that latency is 2s.