ROS 2 Bag File Logging and Analysis
Import, visualize and analyze ROS 2 bag files
ROS toolbox 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.
To extract message 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 ROS 2 bag log file or view a live ROS 2 topic, use the ROS Data Analyzer app.
Apps
| ROS Data Analyzer | Visualize messages from live ROS or ROS 2 topics and bag files (Since R2023a) | 
Functions
| ros2bagreader | Access ROS 2 bag log file information (Since R2021a) | 
| readMessages | Read messages from ros2bagreader object (Since R2021a) | 
| select | Select subset of messages in ros2bagreader (Since R2021a) | 
| getTransform | Return transformation between two coordinate frames (Since R2023b) | 
| canTransform | Verify if transformation is available (Since R2023b) | 
| timetable | Create timetable for selected message properties in ROS 2 bag file (Since R2024a) | 
| ros2bagwriter | Create and write logs to ROS 2 bag log file (Since R2022b) | 
| write | Write logs to ROS 2 bag log file (Since R2022b) | 
| delete | Remove ros2bagwriter object from memory (Since R2022b) | 
Blocks
| Read Data | Play back data from ROS 2 log file (Since R2021b) | 
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 Simulink
- Log ROS 2 Messages from Simulink to ROS 2 Bag File
 Save ROS 2 message data from Simulink to a ros2bag file.




