-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide BagMetadata to the Player and deserialize QoS profiles for la… #371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks OK. This requires some testing IMHO, or was it already covered somehow?
const rosbag2_storage::BagMetadata & metadata) | ||
: reader_(std::move(reader)), rosbag2_transport_(rosbag2_transport), metadata_(metadata) | ||
{ | ||
for (auto topic_information : metadata.topics_with_message_count) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto& to avoid the copy
const auto & loaded_profiles = YAML::Load(topic_metadata.offered_qos_profiles); | ||
recorded_qos_profiles_[topic_metadata.name] = loaded_profiles.as<std::vector<Rosbag2QoS>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the unhappy path? I.e. YAML is not correct. Did we test this? Are we printing out a reasonable error message?
I would also suggest to update the documentation to explicitly state what type of exception may get thrown from the ctor. Seems like we're moving from sonething that never could fail, to something that can "easily" fail (given bad input). It's worth checking the implication on the codebase.
Player player(reader_, transport_node); | ||
rosbag2_storage::MetadataIo metadata_io{}; | ||
rosbag2_storage::BagMetadata metadata{}; | ||
if (metadata_io.metadata_file_exists(storage_options.uri)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really OK not to have metadata?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
legacy rosbags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ROS1 bags loaded with rosbag2_bag_v2 do not have metadata
I somewhat have a problem with that change here as I think we duplicate work here. The reader instance does open the storage and receives the metadata itself. I don't see the point - and maybe that's being more clear with the succeeding PR - why we would open the metadata in the reader and in the player. Why not providing a method on the reader interface to get the metadata? I am a bit worried that in the end we not only duplicate work, but also that if at some point we implement a different behavior in reading the metadata we have to make sure there's no inconsistency between rosbag2_transport and rosbag2_cpp. I am having for example the legacy rosbags in mind, but also any other storage plugin. |
@Karsten1987 the reader does provide My understanding from a previous conversation is that the YAML file should be the only place that we continue updating, and that the sqlite database version of the metadata is there for legacy reasons only. If this is true, then we should probably remove the portion of the writer that writes metadata to the database. In the PR where I added the What should be the one true source of metadata? If it's the YAML file, then I can change the base reader to read it from the YAML file, instead of having the SQLite storage plugin override it to read from the database? |
Looking here I don't think this is true. The sqlite3 plugin (in fact every plugin) reads from the The reason why we still have the |
Signed-off-by: Emerson Knapp <[email protected]>
9eea7e5
to
ac1ee6e
Compare
You're right that it reads the YAML file into the private variable The Should I add an interface |
Yes! To all :) I think this makes a lot of sense. But as with the metadata itself, I think we can't easily remove that function |
Agreed that we can't remove the storage interface right now, but we can skip using it here. I'll go ahead and update the SequentialReader interfaces. |
Closing in favor of exposing this data through the Reader - starting here #372 |
@emersonknapp do you want to keep this branch alive or can it be deleted? |
Deleted |
Part of #125
Reads and provides the BagMetadata to the Player, which stores it and deserializes the QoS profiles that it contains (if present). Does not change behavior, just makes the information available for use in the followup to this PR.
Signed-off-by: Emerson Knapp [email protected]