ros2bagreader unable to parse "metadata.yaml"

Hello, I am trying to open a mcap ros2 bag and I receive the following error:
Error using ros2bagreader (line 478)
Unable to parse "metadata.yaml" file in the specified folder path. Ensure that the YAML file is correctly formatted.
I am using matlab 2024b version.
Any advice on how to solve this issue?
Thank you,
Annalisa

4 Comments

Simone
Simone on 26 Feb 2025
Edited: Simone on 26 Feb 2025
I have the same problem, probably the YAML file version in the rosbags is too recent for the ros2bagreader function. I tried with an old bag, and it works.
I have the same issue. ros2bagreader can't read my .mcap file because there seems to be a problem inside the metadata.yaml file.
@Simone : could you please share your working metadata.yaml file? In order for us to compare the format/structure of this file.
Hi @Annalisa, @Simone, could you please share files to reproduce the issue ?
Simone
Simone on 1 May 2025
Edited: Simone on 1 May 2025
I can't share the entire metadata.yaml file, but I believe the issue can be identified by looking at just these few lines:
rosbag2_bagfile_information:
version: 9
storage_identifier: mcap
duration:
nanoseconds: 156929000527
starting_time:
nanoseconds_since_epoch: 1741604982945181385
message_count: 646482
topics_with_message_count:
- topic_metadata:
name: /mapping/global_slope
type: nav_msgs/msg/OccupancyGrid
serialization_format: cdr
offered_qos_profiles:
- history: unknown
depth: 0
reliability: reliable
durability: volatile
deadline:
sec: 9223372036
nsec: 854775807
lifespan:
sec: 9223372036
nsec: 854775807
liveliness: automatic
liveliness_lease_duration:
sec: 9223372036
nsec: 854775807
avoid_ros_namespace_conventions: false
type_description_hash: ..
message_count: 782
The 'offered_qos_profiles' entry was previously provided as a list, but now (version 9) each sub-entry appears on a new line, and the ros2bagreader function does not work

Sign in to comment.

Answers (1)

Gayathri
Gayathri on 5 May 2025
Edited: Gayathri on 5 May 2025
The error you are experiencing may be due to MATLAB R2024b only supporting bag files created with the ROS 2 distribution "Humble Hawksbill." If your bag file was created using a different ROS 2 distribution, this could be causing the issue.
Starting with the MATLAB R2025a Prerelease, the function is compatible with the ROS 2 distribution "Jazzy Jalisco" and should work without any errors.

Categories

Asked:

on 20 Feb 2025

Commented:

on 8 May 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!