ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

What do I need to read in a .bag file?

asked 2017-07-25 05:05:31 -0500

BlurEffect gravatar image

Hey everybody,

this is the first time I got in contact with ROS as part of my work and I could really need some advice as I can't really seem to find the information I need in the documentation. All I have to do is to read data from a .bag file using c++ (preferably on Windows). I know how to do it in code (saw the example) and I know know that there is a version for Windows (although experimental). But I'm wondering if I have to go through the whole installation process or if I can just download some required parts, and if so which parts would that be? At the moment, I'm pretty confused concerning what I actually need to write a very simple reader application in Visual Studio. I already have the .bag file, there's no need for any functionality apart from reading and I don't want to bloat the project. I hope some of you guys can help me figure this out. If you only know an answer for Linux, that's fine, maybe it can be applied on Windows, too. Thank you very much in advance!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-07-25 06:29:30 -0500

gvdhoorn gravatar image

updated 2017-07-25 06:40:44 -0500

I'm not aware of any C++ version of a rosbag library that is Windows compatible -- other than the one that ROS comes with and would require "going through the whole installation process" (but then on Windows) -- but if Java is acceptable then you could take a look at swri-robotics/bag-reader-java.

You could also just take the swri-robotics classes and reimplement a C++ version.


Edit: the main thing here is rosbag_storage, which is a plain C++ library, but with a set of ROS dependencies. With some work it could potentially be ported to Windows, but that's probably more work than you're willing to do.

edit flag offensive delete link more

Comments

Thank you very much for your answer, I'm checking it out now. I don't think I can use Java, but since C# is acceptable, reimplementing the classes might be an option. After all Java and C# are much closer than Java and C++.

BlurEffect gravatar image BlurEffect  ( 2017-07-25 07:12:27 -0500 )edit

If you do convert to C#, it would be nice if you can make that available somewhere. It could potentially save future readers quite some time when they need to do the same!

gvdhoorn gravatar image gvdhoorn  ( 2017-07-25 07:14:04 -0500 )edit

You mentioned a Windows-compatible C++ library. Do you mean the one included in win_ros, or does it come with the general Linux Installation?

BlurEffect gravatar image BlurEffect  ( 2017-07-25 07:16:23 -0500 )edit

You'll still need to somehow implement all the message deserialisation yourself though. Rosbag treats msgs as binary blobs, it does not do any introspection itself. The SWRI package has some deserialisers for mostly primitive types, but if you're looking for more complex things (like PointClouds) ..

gvdhoorn gravatar image gvdhoorn  ( 2017-07-25 07:16:50 -0500 )edit

.. it's probably going to be some work. I'm not sure, but perhaps uml-robotics/ROS.NET can help there.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-25 07:17:00 -0500 )edit

You mentioned a Windows-compatible C++ library

No, I don't think I did. I wrote that rosbag_storage is as portable as it's going to get, as it is the lowest level of rosbag interfacing code I know of with the least ROS dependencies. But it's still not Windows-ready/compatible.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-25 07:22:08 -0500 )edit

And I just thought I'd mention codenotes/ros_cygwin. Quite old now -- but rosbag hasn't changed much -- and requires cygwin.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-25 07:27:15 -0500 )edit

Yeah, I'm afraid it is going to be quite some work either way. I'll mark the question as answered though since I think the Java lib you mentioned is pretty much as good as it gets for what I was looking for. Again, thank you very much for your help. I'll see what I can come up with

BlurEffect gravatar image BlurEffect  ( 2017-07-25 08:22:13 -0500 )edit
0

answered 2017-07-31 09:05:14 -0500

Hi there! I just thought I'd chip in because I'm the author of swri-robotics/bag-reader-java . If you need to write your own, the bag format is pretty well-documented at http://wiki.ros.org/Bags/Format/2.0 ; writing a reader for it is more tedious than hard. I tried to document the source for the Java reader pretty well, so just let me know if you have any questions about or problems with it.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2017-07-25 05:05:31 -0500

Seen: 4,448 times

Last updated: Jul 31 '17