Here are a few sidenotes on ros2 bag provided. What is ros2bag in summary? It enables to save topics and data during operations with ROS2 nodes running. After saving these topics, it is possible to play these data back and bascially simulate the data, which are streamed, again.
Please read up first about ros2 bag on the official websites:
The commands for executing ros2bag are integrated in the launch files.
The most important command for starting is bascially:
ros2 bag record -o rosbagoutputname /topic1 /topic2
Here are some important notes:
- It is possible to start ros2 bag in a launch file, take a look at the launch file example of the image_processing package.
- If the launchfile and ros2 bag is supposed to be stopped,then do that ONLY WITH CTRL+C, otherwise ros2bag is not correctly finished.