Rosbag statistics

Hi everyone
I’m recording the messages from several topics in a rosbag file by using a node similar to this.
I would like to know is there is a way to know how many messages have been dropped per each topic in the recording proccess. I’m not sure if can use the information provided by the ros2 topic echo command to compare the number of published messages with the number of recorded messages.
Thanks in advance.

Hi @lfernandez ,

Have you tried using ros2 bag info <path/to/rosbag2/file> ?

That gives you all the info you need - all topics recorded, messages in each topic and more.

Regarding the messages dropped, I am not certain if that would record any dropped messages - as dropped messages are basically missed messages. If rosbag has not recorded the message, it would not know that it skipped a message.

But you can try some mathematical inference from the rosbag info output.
So, if you have a topic that has 30Hz frequency and you recorded the rosbag for 10 seconds, you should effectively have 300 messages. If you have anything around 300 +/- 10 messages, then you would know that the recording was correct.
On the other hand, if the recorded messages are less than, say, 250, then you know that about 50 messages were lost / dropped.

I hope this helps!


1 Like

Thanks @girishkumar.kannan!!
I think your approach based on the frequency and the run time is the more accurate option I have to estimate the dropped messages.
I would try by this way.
Thanks again!!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.