Matlab crashes when trying to read rosbag

조회 수: 16 (최근 30일)
Niklas Dörr
Niklas Dörr 2021년 4월 21일
답변: Chidvi Modala 2021년 6월 3일
I am using a ros2 publisher in matlab simulink to publish msgs of msg type "MarkerArray". This topic is recorded in a linux vm using ros2 bag for ros dashing. The ros bags are not corrupted and can be shown in rqt and in rviz. But when I try to read the rosbag into matlab, matlab crashes. Following commands are used to read the rosbag:
folderPath = fullfile(pwd,'rosbag2_2021_04_21-07_36_36');
info = ros2("bag","info",folderPath)
bag = ros2bag(folderPath)
msgs = readMessages(bag)
It crashes when it tries to execute the "readMessages" command. I tried this with other msg types e.g. "point" and it works fine. Also i tried sending an empty "MarkerArray" and it worked fine. I attatched the crash_dump and the zipped project with the rosbag to reproduce the error. I am hoping that this problem is going to be fixed soon as I am really depending on this feature to evaluate my bachelorthesis.
  댓글 수: 2
Karthik Reddy Vennapureddy
Karthik Reddy Vennapureddy 2021년 4월 22일
Hi Niklas,
Contacting MathWorks Technical support at would help you in resolving this issue.
Karthik Reddy
Niklas Dörr
Niklas Dörr 2021년 4월 22일
Hi Reddy
I contacted them today. I was just hoping someone else had come to this point and allready found a way to fix it.
Thank you,

댓글을 달려면 로그인하십시오.

답변 (1개)

Chidvi Modala
Chidvi Modala 2021년 6월 3일
One possible reason can be due to reading all the messages at a time. If we read all the messages with readMessages(bag), then the MATLAB process is being killed by OS or kernel. This is because there will be large number of messages in bag file and each consuming large size. If the available space in memory (RAM) is less than that, then the MATLAB process will be killed.
As a workaround, you can read one message at a time which does not consume lot of memory and the MATLAB process is not killed. Something like the following:
for row=1:msg.NumMessages
pc = readMessages(msg,row);


Help CenterFile Exchange에서 ROS Log Files and Transformations에 대해 자세히 알아보기





Community Treasure Hunt

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

Start Hunting!

Translated by