Skip to content

Commit

Permalink
Remove ROS_DISTRO key-value from mcap::Metadata
Browse files Browse the repository at this point in the history
- ROS_DISTRO now stored inside serialized metadata

Signed-off-by: Michael Orlov <[email protected]>
  • Loading branch information
MichaelOrlov committed Jul 16, 2023
1 parent 0e07506 commit 5e34be8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rosbag2_storage_mcap/src/mcap_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ void MCAPStorage::read_metadata()
try {
metadata_.ros_distro = mcap_metadata.metadata.at("ROS_DISTRO");
} catch (const std::out_of_range & /* err */) {
RCUTILS_LOG_ERROR_NAMED(
LOG_NAME, "Metadata record with name 'rosbag2' did not contain key 'ROS_DISTRO'.");
// Ignor this error. In new versions ROS_DISTRO stored inside `serialized_metadata`.
}
}

Expand Down Expand Up @@ -847,8 +846,7 @@ void MCAPStorage::update_metadata(const rosbag2_storage::BagMetadata & bag_metad
metadata.name = "rosbag2";
YAML::Node metadata_node = YAML::convert<rosbag2_storage::BagMetadata>::encode(bag_metadata);
std::string serialized_metadata = YAML::Dump(metadata_node);
metadata.metadata = {{"ROS_DISTRO", bag_metadata.ros_distro},
{"serialized_metadata", serialized_metadata}};
metadata.metadata = {{"serialized_metadata", serialized_metadata}};
mcap::Status status = mcap_writer_->write(metadata);
if (!status.ok()) {
OnProblem(status);
Expand Down

0 comments on commit 5e34be8

Please sign in to comment.