prevent ros.BagSelection accessing bag.file when being loaded

2 ビュー (過去 30 日間)
Andreas Schwager
Andreas Schwager 2023 年 12 月 11 日
コメント済み: Andreas Schwager 2023 年 12 月 19 日
Hi,
I use a struct containing multiple ros.BagSelection-Objects. The ros.BagSelection-Objects are created by:
myBag = rosbag('myBagFileName.bag');
myStruct.bag(ii) = select(bag,'Topic',myTopic);
The FilePath inside the ros.BagSelection-Objects refer to huge bag-files. This struct is saved to a mat-file. When loading the mat-file it may take incredible long time, until the struct is loaded.
Does the load() or loadobj() method parses all huge bag-files when loading only the BagSelection-Objects?
If 'yes', how to prevent the load() method parsing the huge bag-files?
Thanks!

回答 (1 件)

Prabeen Sahu
Prabeen Sahu 2023 年 12 月 19 日
When a ros.BagSelection object is created, it opens, parses, and indexes the bag file. Saving to a mat file stores metadata and indexing, excluding actual messages.
Loading the mat file opens the bag file without reindexing, facilitating faster loading. However, to read messages, the original bag file must be opened, potentially causing delays if it's large.
  1 件のコメント
Andreas Schwager
Andreas Schwager 2023 年 12 月 19 日
Thanks, this may explain the long waiting time....
Why are the bag-files opened at reading? All info that is present before save, should be included to the mat-file. And after open, it should be available, again.
Is there a way avoiding the opening the bag-files when loading the mat-file? The bag-file may become opened the 1st time reading from it.
Thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by