-
Notifications
You must be signed in to change notification settings - Fork 260
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
Revisit rosbag2 internal data structures #677
Comments
Thinking out loud for a moment: If we decouple the serialized payload from the topic information as such: struct SerializedBagMessage
{
std::shared_ptr<rcutils_uint8_array_t> serialized_data;
rcutils_time_point_value_t time_stamp;
std::string type_name;
std::string serialization_format;
};
struct TopicMetadata
{
std::string name;
// Serialized std::vector<rclcpp::QoS> as a YAML string
std::string offered_qos_profiles;
bool operator==(const rosbag2_storage::TopicMetadata & rhs) const
{
return name == rhs.name;
}
}; we'd need a slightly more complex API for reading and writing: void write(
std::shared_ptr<const rosbag2_storage::SerializedBagMessage> message,
const rosbag2_storage::TopicMetadata & metadata);
std::pair<std::shared_ptr<rosbag2_storage::SerializedBagMessage>, rosbag2_storage::TopicMetadata> read_next(); I believe though that ultimately this leads to a more intuitive API. The |
Please let me know what you think about it. This ticket is generally also in conjunction with #457 which introduces I hope to get some of this in before Galactic feature freeze. |
This turns out to be a non-trivial change. The main culprit I am seeing so far is that the serialized bag message as well as the topic metadata are represented in the sqlite3 data base as they are. That means, modifying these values leads to a modification in the database layout. That further means, we'd have to increase the bag-version number once more making it basically impossible to read old bag files with a current/newer rosbag version. |
Must this be true? I would think we could change the API but keep it so that the insert statements stay the same. This may make the write/read portion of storage implementation a little more complex. But, the rosbag2 generic API and the on-disk bag representation don't have to be a 1:1 match.
Even if we accept the above, that we change database layout - I don't think this means we have to change the bag version number. My understanding of the bag version number is that it relates only to the metadata format, and that the storage implementation is responsible for everything that happens after that. In that case, if the metadata stays the same but the layout changes, would maybe the storage implementation (such as Regardless of that - rosbag2 needs to solve the "old bag problem" in some way - we will have to make changes at some point, it seems inevitable. I see two ways:
We have already done some ad-hoc implementation of the versioning API in the metadata parsing - although I'm not sure if it's the ideal way to handle it, it seems like it will become unmanageable after a few versions. |
I am actually interested in this... I find the conversion of data from one format to another to be an interesting puzzle. Should I open a brainstorming issue for this? |
If you have ideas which you can concentrate solely around the bag conversion topic, I'd suggest to open a dedicated ticket for it. For other general data type issues, we can continue the discussion here. |
Just discovering the rosbag2 api, but I strongly agree with this. It would be nice to be able to check the type of the message contained in |
Just want to note that you don't actually have to do this, I think it's slightly beside the point of the comment - there is a |
Yes but that implies having access to the |
We have complaints from other users about the excessive memory usage of the rosbag2 recorder by storing the topic name as a string in the |
For the longest time I am actually kind of unhappy with the way we spread out our data structures in rosbag2_cpp and rosbag2_storage. Across these two we have:
I feel there's a strong redundancy in quite a few of them, which makes the actual rosbag2_cpp API really user-unfriendly.
Semantically, I mostly would like to revisit the
SerializedBagMessage
. I don't think it's sensible to attach serialized data strictly to a topic. I would much rather see it attached to a type. The consequence of this would be that we don't just have a call towrite(serialized_message)
, but more like awrite(serialized_message, "topic_name")
which to me also makes way more sense.The text was updated successfully, but these errors were encountered: