ROS 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.
Use 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 visualize the messages in a ROS bag log file and view live ROS topics, use ROS Data Analyzer app.
Apps
ROS Data Analyzer | Visualize messages from live ROS or ROS 2 topics and bag files (Since R2023a) |
Functions
rosbagreader | Access rosbag log file information (Since R2021b) |
select | Select subset of messages in rosbag |
timeseries | Create time series object for selected message properties |
timetable | Create timetable for selected message properties in ROS bag file (Since R2024a) |
rosbagwriter | Create and write logs to rosbag log file (Since R2021b) |
write | Write logs to rosbag log file (Since R2021b) |
rosbag | Open and parse rosbag log file |
readMessages | Read messages from rosbag |
BagSelection | Object for storing rosbag selection |
Blocks
Read Data | Play back data from log file |
Topics
Bag File Analysis
- Get Started with ROS Data Analyzer App
Use ROS Data Analyzer app to visualize messages from live ROS or ROS 2 topics and bag files.
Bag Logging in MATLAB
- ROS Log Files (rosbags)
Summary of the structure of rosbags and the workflow for selecting subsets of messages in a rosbag. - Work with rosbag Logfiles
Load arosbag
, and learn how to select and retrieve the contained messages.
Bag Logging in Simulink
- Log ROS Messages from Simulink to a Rosbag Logfile
Save ROS message data from Simulink to a rosbag file.