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

Revision history [back]

click to hide/show revision 1
initial version

Please apologize the late response. This post really just now came to my attention. We've recently added a test which should illustrate the use of the C++ API to write data to a rosbag. https://github.com/ros2/rosbag2/blob/master/rosbag2_tests/test/rosbag2_tests/test_rosbag2_cpp_api.cpp

We're working on making this more user-friendly in the near future and to enhance the functionality further to allow writing non-serialized messages directly.

Looking at the above code snippet, there might be a confusion on when to use the converter API. The converters should really only be used when dealing with different middlewares, aka rmw implementations, which each have different serialization formats. A bit of context: ROS2 is designed to support multiple middlewares and we can't guarantee that the format in which data was recorded is the same as the format used when replaying this data. Therefore, we introduced plugins to convert data on-the-fly to different serialization formats. This shouldn't be necessary though when dealing with only one middleware.