ROS2 Bag - DB3 CDR Deserialization

asked 2020-03-17 17:26:44 -0600

yossi_ov gravatar image

updated 2020-03-17 17:27:19 -0600


Examining the recorded bag I see that the data is stored in SQLite database, and I can see all the recorded messages in the corresponding table.

The problem is that I cannot find a way to decode the messages' data which is stored in binary format (CDR).

Is there a better way to fetch the messages from saved bag? Or is there some documentation / examples on how I can deserialize the data?

edit retag flag offensive close merge delete


Related: #q321618.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-18 03:16:57 -0600 )edit

Well it is, and I see that there is an example for C++ but no working example for Python.

yossi_ov gravatar image yossi_ov  ( 2020-03-18 10:54:50 -0600 )edit

The article linked by the OP suggests otherwise.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-18 11:00:10 -0600 )edit

OP (vadbut) referenced ROS1 API, not ROS2

@kyungpyo Put a link to a blog in Korean where he presents an example interfacing a bag using C++.

The short paragraph on Python API demonstrates an example code which fails on clean ros-dashing-desktop : it fails to import required modules (do tell if you succeed).

Reference link in the same paragraph leads to an open issue in rosbag2 github repository, where jacobperron presents a PoC (the aforementioned example), however one of required branches for the example to work is missing, and there are no clear way to make it work.

It seems that the features will be added to next ROS2 release, though?

yossi_ov gravatar image yossi_ov  ( 2020-03-18 12:04:47 -0600 )edit

The OP of #q321618 writes:

I'm trying to find a way to process a ros2 bag

the question is also tagged ros2.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-18 12:11:30 -0600 )edit

You are right, thank you.

yossi_ov gravatar image yossi_ov  ( 2020-03-18 12:26:26 -0600 )edit

FWIW, we are working on a Python API ( and I've recently added methods for (de)serializing ROS messages in Python to rclpy:

jacobperron gravatar image jacobperron  ( 2020-03-18 22:18:11 -0600 )edit