Bag File Logging and Analysis
The message data in ROS topics are stored in log files called ROS bag files or rosbags. You can use MATLAB® functions, apps and Simulink® blocks to access, filter and execute offline analysis of ROS data in these rosbag files. These bags are often created by subscribing to one or more ROS topics, and storing the received message data in an efficient file structure. For an example of working with rosbags, see Work with rosbag Logfiles.
ROS toolbox also allows access to the message data in ROS 2 bag files or ros2bags. You can filter the ROS 2 data and execute offline analysis in these ros2bag files.
rosbagreader to extract message data from a rosbag and
rosbagwriter to create a rosbag log file and write logs to it. You can
also use the ROS Logger app to record ROS messages during Simulink simulation. For more information, see Use ROS Logger App to Save ROS Messages from Simulink.
To extract massage data from a ros2bag log file, use the
ros2bagreader object. To write logs to a ros2bag log file, use the
ros2bagwriter object. You can also record ROS 2 messages during a
Simulink simulation by using the ROS 2 Logger app. For more
information, see Use ROS 2 Logger App to Save ROS 2 Messages from Simulink.
To visualize the messages in a ROS or ROS 2 bag log file, use ROS Bag Viewer app.
|ROS Bag Viewer
|Visualize messages in ROS or ROS 2 bag file (Since R2023a)
ROS 2 Bag Log Files
|Access ROS 2 bag log file information (Since R2021a)
|Read messages from ros2bagreader object (Since R2021a)
|Select subset of messages in ros2bagreader (Since R2021a)
|Return transformation between two coordinate frames (Since R2023b)
|Verify if transformation is available (Since R2023b)
|Create and write logs to ROS 2 bag log file (Since R2022b)
|Write logs to ROS 2 bag log file (Since R2022b)
|Remove ros2bagwriter object from memory (Since R2022b)
ROS Bag Log Files
|Open and parse rosbag log file (Since R2019b)
|Read messages from rosbag (Since R2019b)
|Access rosbag log file information (Since R2021b)
|Create and write logs to rosbag log file (Since R2021b)
|Write logs to rosbag log file (Since R2021b)
|Select subset of messages in rosbag (Since R2019b)
|Create time series object for selected message properties (Since R2019b)
|Object for storing rosbag selection (Since R2019b)
Bag Logging in MATLAB
Bag Logging in Simulink
- Log ROS 2 Messages from Simulink to a ROS 2 Bag File
Save ROS 2 message data from Simulink to a ros2bag file.
- Log ROS Messages from Simulink to a Rosbag Logfile
Save ROS message data from Simulink to a rosbag file.