Visualize Custom and Non-ROS Schema Messages from Bag Files
R2026bThe ROS Data Analyzer app enables you to visualize custom ROS and ROS 2 messages using adapters. An adapter converts a custom message into a format that the app can display.
The app also supports visualizing non-ROS schema messages, such as OMG IDL-encoded messages in MCAP files. MCAP files can contain messages that use OMG IDL schemas instead of standard ROS message definitions. You can create an adapter to convert these messages into a format that the app can display. You can also inspect them directly in the app without converting them.
Note
To visualize custom ROS or ROS 2 messages, MATLAB® must recognize the message definitions. If the messages are not already
registered, generate the message package using the rosgenmsg function for ROS or ros2genmsg
function for ROS 2. You can verify that MATLAB recognizes the custom message types by listing them using rosmsg
list or ros2
msg list. This requirement does not apply to non-ROS schema messages,
which the app can load directly.
Supported Message Type Conversions for Visualization
The ROS Data Analyzer app visualizes custom messages by converting them into supported standard message types. You can create adapters only for custom messages whose data can be meaningfully mapped to a supported standard message type that has an associated visualizer. Typically, custom messages are messages that contain image-based or spatial data suitable for visualization.
| Target Standard Message Type | Supported Visualizer |
|---|---|
| Image Viewer |
sensor_msgs/PointCloud2 | Point Cloud Viewer 3D Viewer |
sensor_msgs/LaserScan | Laser Scan Viewer 3D Viewer |
nav_msgs/Odometry | Odometry Viewer |
| Map Viewer |
| Marker Viewer 3D Viewer |
Tip
Adapters can also modify or transform standard message data before visualization. For example, you can apply the conversion logic of an active adapter to image data before rendering it in the Image viewer.
When to Use Message Adapters
Use message adapters to convert, modify, or transform message data for visualization without changing the contents of the input ROS or ROS 2 bag file.
Adapters enable you to apply restructuring logic or processing algorithms, such as field remapping, filtering, or data transformation, so that you can visualize data using the visualizers supported in the app. You can update adapter logic and immediately revisualize the data, which makes adapters useful for iterative analysis and experimentation.
The following examples illustrate how adapters support different visualization workflows.
Specify Location to Save Message Adapter Files
You can save adapter files to reuse them in future sessions. To save an adapter file to a folder, click Create on the Message Adapters tab on the app toolstrip, and then select a folder to save the adapter files.
You set this location once and the app reuses it in future sessions. You can set or change the folder at any time without opening a bag file.
Define Message Conversion and Generate Adapter
After you select the adapter store location, the app opens the Adapter Creation Utility dialog box.

In the Adapter Creation Utility dialog box:
Select a ROS Version based on whether you are working with a ROS bag file or a ROS 2 bag file.
Select the From Message Type to specify the custom message type that you want to convert.
Select the To Message Type to specify the supported standard message type to convert to.
Enter a name for the adapter in the Adapter Name field.
Click Generate Adapter to generate the MATLAB plugin file (
.m), which opens in the MATLAB Editor. Edit this file to implement the conversion logic that maps your custom message fields to the target visualization message type.
Manage Adapters Using Adapter Manager
From the Message Adapters tab, click Manage to open Adapter Manager. The Adapter Manager window displays all the registered message adapters. For each adapter, the table shows the source message type, the target message type after conversion, the ROS version, and the adapter name.

Use Adapter Manager to:
Create new adapters in the Adapter Store.
Edit adapters to update conversion logic in the associated MATLAB plugin file (
.m).Remove selected adapters from the list.
Export selected adapters for sharing by packing them in a ZIP file.
Import adapters from ZIP files.
Filter adapters by name or message type using the search bar.
Change the location to store adapters using the folder icon next to Adapter Store that lists the current path to store adapters.
The Adapter Manager window updates automatically when you remove or edit an existing adapter.
Visualize Custom Messages
After you register an adapter, the app adds the custom message types to Topic List.
Open a supported visualizer and specify an adapter in Active Adapter to apply the appropriate message conversion. After you apply the adapter, select the custom message from the Select Data Source drop-down list to visualize the data.



