Access specific message in rosbag file

asked 2016-06-21 09:08:43 -0500

ROSkinect gravatar image

updated 2016-06-22 04:51:17 -0500

I can get all the messages in my rosbag file through this loop:

BOOST_FOREACH(rosbag::MessageInstance const m, view) {
   //...
}

My rosbag file is a record of images from the Kinect. And I'm trying to get the images from it.

Knowing the size of rosbag, how could I use rosbag::MessageInstance and view to get a specific message (or image) without going through all the messages.

EDIT:

I did a "mecanical" solution but I don't really like it:

I ask the user to choose a number which will correspond to his message (image) knowing the size of the rosbag file. then I run BOOST_FOREACH loop till I get to the message and extract it.

edit retag flag offensive close merge delete

Comments

I'd guess you can't, but maybe you can check the source code of rosbag play for how it treats the -s (start time) option. If you could jump to a certain timestamp, it probably would be done there.

Felix Endres gravatar image Felix Endres  ( 2016-06-21 09:41:39 -0500 )edit

I'll check it out..

ROSkinect gravatar image ROSkinect  ( 2016-06-22 04:51:51 -0500 )edit