Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rosbag reader #2215

Closed
marcovs opened this issue Aug 8, 2018 · 9 comments
Closed

rosbag reader #2215

marcovs opened this issue Aug 8, 2018 · 9 comments
Assignees

Comments

@marcovs
Copy link

marcovs commented Aug 8, 2018

Starting from issue #1919, I worked on it a little bit and I made a class that reads bag files using directly the rosbag API. It implements the following functionalities

  1. Reads a bag file and outputs a pair of rgb and depth frames asynchronously whenever the function nextFrame is called. The class does not use the realsense pipeline, rather it parses the rosbag messages, so there are no frames dropped

  2. Since AFAIK there is no hardware synchronization between rgb and depth streams on the device, the class checks the timestamps and outputs the pair of rgb and depth files that are closest in time (without expensive searches).

  3. The depth frame returned is aligned to the camera point of view

  4. Depth frame is saved as an xml with the full floating point values in meters for each pixel

  5. Together with the frames, the class outputs the frame number and the timestamp for each frame recorded in the rosbag (according to the system clock)

  6. It also saves the intrinsic and extrinsic matrices for both sensors in case you want to do some geometry

The code should be quite readable, and the dependencies are opencv 3.x, glog, librealsense, and the part of the ros library included as headers, and boost. The files print_helpers.cpp/h are a modified version of the ones included in the rosbag viewer tool example.

Even if you don't use the class directly, you should be able to copy and paste the methods inside the class to read the rosbag however you want.

Hope it helps
RealSenseHelper.zip

@dorodnic
Copy link
Contributor

dorodnic commented Aug 8, 2018

Hi @marcovs
Thank you for sharing your work! This can help us solve existing problems in the SDK and help other users in meantime.
If you prefer not to create a PR to the SDK, please add one of the common licenses to the archive so people can legally use it.

@marcovs
Copy link
Author

marcovs commented Aug 9, 2018

Hi @dorodnic thank you, just updated the archive with MIT license, everyone should be free to use it and hack it

@dorodnic
Copy link
Contributor

Hi @marcovs
I have added the link to this page under Examples / Community Projects.
Feel free to reconsider making it a pull-request or relocating to GitHub repo.
Very cool, thank you!

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
This issue should be resolved in 2.16.1.

@HippoEug
Copy link

The rosbag library (dependency) is not supported for windows, correct?

@SunshineDou
Copy link

Hi, I want to use the RealsenseHealper in Visual Studio, But when I compiled, it said that:
fatal error C1083: cannot open file:"rosbag/bag.h": no such file or directory.
what's the problem? how to solve it? @marcovs

@timsta613
Copy link

Hi,

I'm having a similar problem in that I'm having trouble with pointing the project to its respective dependencies. @marcovs Is there an example CMakesList.txt file that you used for this?

@hrdkjain
Copy link

hrdkjain commented Mar 13, 2019

There seems to be a couple of fixes to resolve include and linker error, try adding following include directories

include_directories(librealsense/third-party/realsense-file/rosbag/cpp_common/include/)
include_directories(librealsense/third-party/realsense-file/rosbag/rostime/include/)
include_directories(librealsense/third-party/realsense-file/rosbag/roscpp_traits/include/)
include_directories(librealsense/third-party/realsense-file/boost/)
include_directories(librealsense/third-party/realsense-file/rosbag/roscpp_serialization/include/)
include_directories(librealsense/third-party/realsense-file/rosbag/msgs/)

along with the -lglog linker flag in CMakeLists.txt

@Imel23
Copy link

Imel23 commented Oct 14, 2019

@marcovs @hrdkjain please could you provide us the CMakesList.txt. Thank you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants