Export ROS or ROS 2 Bag File Data
Search Bag Files Using Tags, Bookmarks and Visualizers and Export Search Results
The ROS Data Analyzer app allows you to search across all previously opened bag files using the tags, bookmarks and visualizers as filters. To know how to add and manage tags and bookmarks, see Add and Manage Tags and Add and Manage Bookmarks respectively.
To search across previously opened bag files, follow these steps:
From the app toolstrip, click Open > Search Bag File. This opens the search dialog.
Under Search Filters panel:
Select the desired tags. You can search manually across all the tags using the search bar.
Select the desired bookmarks. You can search manually across all the bookmarks using the search bar.
Select the desired visualizers. This filter denotes the visualizers that were open during the bag file visualization.
All selected filters will appear in the Active Filters panel.
The Search Results panel shows the list of bag files which satisfy at least one criterion from the Active Filters panel.
You can export the search results to a CSV file by clicking the Export icon on the top right corner just above the Search Results panel.
When working on algorithms that generate numerous bag files, managing a large dataset of multiple bag files becomes essential. To export results from a specific bag file in this large dataset, use metadata such as tags, bookmarks, and visualizers to search the relevant file. You can then export the results to a CSV file, which can then be imported into MATLAB® as a table for further analysis and integration into your workflow.
The video below shows how to add tags and bookmarks to three bag files based on the
severity of errors captured by the vehicle camera. It then exports the data
corresponding to high severity into a CSV file and to import it to MATLAB using the readtable
function.

Export Data Using Topics or Bookmarks
The ROS Data Analyzer app now enables you to export your topics and bookmarks and save them to a BAG or MCAP file.
Export Data from Topics
From the app toolstrip, click
Export
and select Export data from Topics. This opens the export dialog specific to exporting data from topics.Select one or multiple topics from the list under Select Topic.
Use slider to select the timestamp range for which you want to export the data. You can also enter Start time and Duration as alternatives to update the minimum and maximum thumbs of the slider respectively.
Click the dropdown to select
.bag
to save the data exported from a ROS bag file. To save the data exported from a ROS 2 bag file, you can choose.bag
or.mcap
from the dropdown.Click Export to export data based on the chosen parameters.
Export Data Using Bookmarks
From the app toolstrip, click
Export
and select Export data using Bookmarks. This opens the export dialog specific to exporting data using Bookmarks.Select one or multiple bookmarks from the list under Select Bookmark.
Click the dropdown to select
.bag
to save the data exported from a ROS bag file. To save the data exported from a ROS 2 bag file, you can choose.bag
or.mcap
from the dropdown.Click Export to export data based on the chosen parameters.
When working with a single large bag file containing numerous topics, exporting data using topics or bookmarks provides two distinct methods to streamline your analysis by focusing on specific data.
Use the Export Data from Topics functionality to focus on
specific message types by selecting topics of interest in the bag file and defining
a timestamp range for data export. Similarly, leverage the Export Data
Using Bookmarks feature to target specific events or scenarios marked
by bookmarks. These predefined markers enable you to extract only the relevant
segments associated with critical events. In both cases, the data can be exported to
a .bag
or .mcap
file, ensuring focused and
efficient analysis without the distraction of unrelated data.
The video below shows how to export lidar data from topics containing point cloud messages in a bag file. Additionally, it showcases the option to export the complete dataset associated with a bookmark created over a specific timestamp.
