-
Notifications
You must be signed in to change notification settings - Fork 58
Better handling of large bag files #178
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
Conversation
Opening a bag now does not read it multiple times and the entries are not buffered in memory. Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
|
Jazzy backport with minimal changes is here: peci1@d90624d . |
Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
ahcorde
left a comment
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.
There are some conflicts, do you mind to take a look ?
|
I'll have a look. |
# Conflicts: # rqt_bag/src/rqt_bag/rosbag2.py
|
Updated. |
|
Pulls: #178 |
|
This PR should not break API (it only adds optional keyword args to a few methods and a few new methods). The behavior of all existing functions should also be the same (except they might be much faster). So I think this PR can be backported to Kilted and Jazzy. |
|
The only behavioral change is that get_entries_with_bags() from bag_timeline.py started to respect the |
|
https://github.com/Mergifyio backport kilted jazzy |
✅ Backports have been createdDetails
|
Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz> (cherry picked from commit c7d3efd) # Conflicts: # rqt_bag/src/rqt_bag/bag_timeline.py # rqt_bag/src/rqt_bag/rosbag2.py # rqt_bag/src/rqt_bag/timeline_frame.py
Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz> (cherry picked from commit c7d3efd)
There were two problems in the codebase:
timeline._update_index_cachewas called per invalidated topic, which resulted in multiple reads of the whole bagfile (each topic seeks the reader to the bag start and forces it to read throughout the whole bag). There might be some caching on the way so that rqt_bag doesn't read 20x12 GB for a 12 GB file with 20 topics, but it did definitely read much more than 12 GB.BagTimeline.get_entries(). This was a smaller problem in the per-topic scenario, but a big problem in the all-topic one. But even in the per-topic scenario, rqt_bag needlessly cached gigabytes of entries (e.g. for an image topic) just to sort them.This PR fixes both issues by utilizing a set of generators, one per bagfile, which produce messages simultaneousely and the earliest of all messages is taken.
I also got the progressbar working much more nicely (however, it only seems to work when loading the first bag).
Tests
The tests were performed on a 12 GB MCAP bag. Before each test, the bag file was evicted from FS cache.
I also wanted to test on a 70 GB bag file, but I didn't have enough hours and RAM to wait until it loads from a USB3 SSD. With this PR, it should be easy to open it (however, I can only verify that tomorrow).
Without this PR
Obrazovkove.vysilani.2025-05-08.13.49.15.mp4
With this PR
Obrazovkove.vysilani.2025-05-08.13.47.10.mp4
The problem mentioned in #166 that clicking on the timeline is super slow on large bags, still remains, however. But that's for a future PR.