[ros-users] getting recorded data into a bagfile

Jeremy Leibs leibs at willowgarage.com
Tue Jul 6 17:59:13 UTC 2010


On Tue, Jul 6, 2010 at 9:23 AM, Michael Styer <michael at styer.net> wrote:
> Hello,
>
> Earlier this year (before I started working with ROS), I did a project
> using a pre-recorded robot navigation dataset (from RAWSEEDS). I'd like
> to try re-implementing the project in ROS, and of course it would be
> great to be able to use the ROS bagfile tools to play back the data. But
> it's not in a bagfile now.
>
> Has anyone else had to get data that was recorded in a different format
> into the ROS bagfile format? If so, how did you do it? (Even better if
> it was one of the RAWSEEDS datasets...)
>

I have no familiarity with the RAWSEEDS datasets, but it has been our
goal to make this kind of transformation as painless as possible,
which is why we have provided a programmatic interface for both
reading and writing to bagfiles in cturtle.

The only hard part is going to be writing yourself a parser for your
existing file format that loads the data into the appropriate ROS
messages.  Someone else may be able to provide you with some more
advice on that front.

Once you have the data extracted from your current format and loaded
into an appropraite ROS message, dumping it into the bag is trivial.

You can take a look at: http://www.ros.org/wiki/rosbag/cturtle for
some information on writing to bagfiles using the C++ or python APIs.

In C++, you should basically be able to do something like:


rosbag::Bag bag;
bag.open("rawseeds.bag", rosbag::bagmode::Write);

for ( ... )
{
   SomeMsg m = readNextFromRAWSEEDS();

   bag.write("topic", m.header.stamp, m);
}

bag.close()



Obviously there might be slightly fancier logic required if you are
reading different message types, but that's still all going to be in
your parser.

Good luck!


> Thanks.
>
> Mike
>
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



More information about the ros-users mailing list