A bag file in ROS is for storing ROS message data from topics and services. The .bag extension is used to represent a bag file.
Bag files are created using the rosbag command, which will subscribe one or more topics and store the message's data in a file as it's received. This file can play the same topics as they are recorded from or it can remap the existing topics too.
The main application of rosbag is data logging. The robot data can be logged and can visualize and process offline.
The rosbag command is used to work with rosbag files. Here are the commands to record and playback a bag file:
- $ rosbag record [topic_1] [topic_2] -o [bag_name]: This command will record the given topics into a bag file that is given in the command. ...