0
$\begingroup$

Rosanswers logo

Hi

I have a data set, which contains several time stamped csv files.

One of the files contains time stamped gps data and the other contains LIDAR data. I want to convert these csv files into a Rosbag file.

What would be the simplest way of making a bagfile?

I have opened a bagfile and all I see is hex I guess this is because of some compression? Also I have looked at the format of bagfiles and it looks complicated. Are there any tools or libraries to write bag-files which are simple to use?

I guess the alternatives would be for me to parse the files, try and play them back using the timestamps, publish rostopics and use the rosbag record. However with this method the original timestamps will not be maintained and I am not sure if I can publish all the topics at the appropriate frequencies.


Originally posted by Sentinal_Bias on ROS Answers with karma: 418 on 2014-01-17

Post score: 3

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

I believe the simplest and most robust way would be to write a little standalone tool that parses your cvs file, creates appropriate ros message objects, and uses the rosbag API to directly write a bagfile. You can use either C++ or python.

This way you are not dependent on a running ROS core and you don't have to worry about publishing rate, dropped messages etc, while getting the fastest conversion rate possible.

API: http://wiki.ros.org/rosbag/Code%20API

There are some small examples manipulating existing bad files. In your case you have the cvs files as input, and only for output use rosbag: http://wiki.ros.org/rosbag/Cookbook

P.S.: Even if you use the publishing node variant, if you set the header.stamp value properly according to your cvs file, you should end up with correct timestamps in the bag file. Note that while in the bag file the stamp of when each message was recorded is not part of the message itself. If the recorded message has a header, this is in general a different timestamp (namely the one you set when publishing the message). So when you read the message back from the bag file later, you likely want to use the timestamp in the header, not the one of when the message was recorded.


Originally posted by demmeln with karma: 4306 on 2014-01-20

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by PeterMilani on 2014-01-20:
Good links!

$\endgroup$
0
$\begingroup$

Rosanswers logo

as you suggest, I think if you wrote a node that reads your csv file, and then publishes the information across a topic to ros-bag that would be the simplest way to do this. It may be slow, but I guess you could play with the publishing rate, or the way you structure your messages.

As for ensuring your time stamps are correct, ros::time has two elements ros::time::nsecs and ros::time::secs, plus a number of other functions that you can use to place your csv time in the message.header.stamp value. It seems you may have tried this as well, did the timestamps not come through correctly?


Originally posted by PeterMilani with karma: 1493 on 2014-01-19

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.