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

Revision history [back]

The relevant info on how to read and write from bagfiles in C++ is here: rosbag C++ Code API.

The example programs on that page are not ROS nodes, but normal C++ programs in the sense that they don't communicate in any way with a roscore, but instead simply read and write bag files. But there's nothing to prevent you from using that code in a ROS node and publish the messages you just read from the bag file.

Make sure you publish the /clock topic, and that you publish the messages at the right time. If you somehow wish to improve on rosbag, it's probably a good idea to read and understand the rosbag source code first.