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:
- load bag-file using: bag_msgs = rosbag(...)
- extract all topics from bag-file: all_topics = bag_msgs.AvailableTopics.Row
- loop over all topics
- get all messages of some topic: topic_msg = select(bag_msgs,'topic',topic_name)
- 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 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!