loading/processgin rosbag takes too much time

Dear reader,
For some project, I need to process the contents of a bag-file in Matlab. For this I basically follow the proposed procedure of the Matlab-help pages:
  1. load bag-file using: bag_msgs = rosbag(...)
  2. extract all topics from bag-file: all_topics = bag_msgs.AvailableTopics.Row
  3. loop over all topics
  4. get all messages of some topic: topic_msg = select(bag_msgs,'topic',topic_name)
  5. extract all data of the topic into a timeseries data-structure: mat_data = timeseries(topic_msg)
I am, however, unpleasantly surprised by the time it takes to run this loop.
My bag-file has the following properties:
  • 12,777,785 bytes
  • recorded time-span: 122.65 seconds
  • 27313 messages, divided over only 4 topics
The above described loop of processing the bagfile data takes up 167.2 seconds, which I think is way too slow. In the near future I will work with much larger bag-files, containing much more than 4 topics.
My question: how can I improve the reading/processing speed of a bag-file in Matlab?

回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品

版本

R2017b

提问:

2019-3-18

Community Treasure Hunt

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

Start Hunting!

Translated by