2

I have a rosbag file, which has recorded messages of several topics.

Is there a way I can know the frequency at which the messages of a particular topic were published (and recorded)?

when I do rosbag info I get something like

path:        the.bag
version:     2.0
duration:    60.0s
start:       Jul 01 2021 16:58:10.27 (1625158690.27)
end:         Jul 01 2021 16:59:10.27 (1625158750.27)
size:        6.1 GB
messages:    37131
compression: none [1188/1188 chunks]
types:       sensing_msgs/type1    [621fdfebbc8899ba27ee5fed4fcccaee]
             sensing_msgs/type2 [cf69c51b4a51518b0ef7e36af744fc70]
             sensor_msgs/Image       [060021388200f6f0f447d0fcd9c64743]
topics:      /mycamera/image         1187 msgs    : sensor_msgs/Image      
             /mymessage1            29944 msgs    : sensing_msgs/type1
             /mymessage2/input       6000 msgs    : sensing_msgs/type2
KansaiRobot
  • 7,564
  • 11
  • 71
  • 150

2 Answers2

1

If you know message publication is continuous throughout the recording frequency is just total_messages / time. Otherwise you can get frequency via rosbag play <bag_file> and rostopic hz <topic_name>

BTables
  • 4,413
  • 2
  • 11
  • 30
0

rosbag command has the option to do it.

rosbag info <bag_name> --freq
SDADEEC
  • 19
  • 2