Rosbag in ROS2

Is rosbag available in ROS2?

It’s not yet available, unfortunately. I’ve started working on a design document, but it’s work in progress as I still have to evaluate the best underlying storage format.
Feel free to comment on the design PR:

https://github.com/ros2/design/pull/160

Karsten,
Is it worthwhile to have a rosbag port to ROS2 for the interim? I could do something (maybe with a little help) so that we can atleast record/play bags without resorting to the ros1 bridge. My current idea was to simply port rosbag’s subscription/publish/node stuff to ROS2

I personally would advise against it. We are starting the rosbag2 development soon and I don’t think that maintaining two systems does bring much benefit. Also I believe, using the bridge for using existing ROS1 bags does work (to a realistic degree) as such an interim.

To simply port the pub/sub to ROS2 won’t bring you that much as things like connection information (type information, quality of service parameters, etc) won’t be trivially portable. I’ll try to break down my idea of development into multiple bits and tasks so that it’s possible to contribute.

Also I believe, using the bridge for using existing ROS1 bags does work (to a realistic degree) as such an interim.

I can entirely second this. We are piping through the ros1_bridge (used in ros1_bridge/src/parameter_bridge.cpp at master · ros2/ros1_bridge · GitHub mode, ROS2 => ROS1 direction) ~10MB/s of data and don’t have any problem neither with latency nor with throughput.

We’ve created a github issue for tracking the development of rosbags for crystal:

Feel free to keep an eye on it. At this point, it’s pretty rough and I am not able to distribute any easy tasks here. But I will update it with individual sub-tasks which hopefully give us the opportunity to make some of them available for contributions.

1 Like

Hi Karsten… I have a question, How long it may take first release version of rosbag2 with play and record? does it support backward compatibility

In its current form you can record, replay and get some basic info about rosbags. It’s not released, so you have to build it yourself from source, but we’re aiming to have rosbags part of the upcoming Crystal release.

once compiled, it extends the ros2cli with the verb bag. So that you can run:

ros2 bag record -a   #record all topics
ros2 bag play <bag_file>  #replay recorded bag file
ros2 bag info <bag_file>  #print information of a bag file

Currently, it’s using SQLite3 as a storage backend by default, but the storage API is flexible enough to load various storage backends via pluginlib. One of these backends will hopefully be ROS1. The idea here is to load ROS1 data from existing ROS1 bags and convert them to ROS2 via the static ros1bridge.

1 Like

Very nice design decision.