- For the next steps, please note that you will need the "rt_msgs ROS package" (since it contains the message definition for the custom message). This package is not publicly available, but the full rt_msgs package can be obtained from the machine which recorded the bag file.
- Create a new folder in a writable location, e.g. "custom_messages"
- Copy the "rt_msgs" package folder into "custom_messages"
- Execute "rosgenmsg('custom_messages')". This will generate all necessary files that MATLAB needs to handle dbw_mkz_msgs.SteeringReport.
- Once it finishes successfully, "rosgenmsg" will display three steps (modify javaclasspath, change MATLAB path, restart MATLAB). Please follow these steps.
- After restarting MATLAB, you should be able to read the rosbag and extract the messages.
Unable to access ROSbag topics
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a bag file and would like to work with it in MATLAB.
I can view the messages for one of my topics using:
>> bag = rosbag('HMB_1.bag');
>> bagselect_c = select(bag, 'Topic', '/center_camera/image_color/compressed');
>> msgs_c = readMessages(bagselect_c);
when I try to do the same for another topic, I get an error:
>> bagselect= select(bag, 'Topic', '/vehicle/steering_report');
>> msgstemp = readMessages(bagselect);
Error using robotics.ros.BagSelection/deserializeMessages (line 445)
Java exception occurred:
org.ros.exception.RosMessageRuntimeException: java.lang.ClassNotFoundException: dbw_mkz_msgs.SteeringReport
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:66)
at org.ros.internal.message.DefaultMessageFactory.newFromType(DefaultMessageFactory.java:42)
at org.ros.internal.message.DefaultMessageDeserializer.deserialize(DefaultMessageDeserializer.java:42)
Caused by: java.lang.ClassNotFoundException: dbw_mkz_msgs.SteeringReport
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:62)
... 2 more
Error in robotics.ros.BagSelection/readMessages (line 195)
msgs = obj.deserializeMessages(obj.MessageList, rows);
I'm not sure how to troubleshoot.
댓글 수: 0
채택된 답변
Kushagr Gupta
2017년 3월 16일
This error is a result of the rosbag containing custom message types (e.g. 'dbw_mkz_msgs.SteeringReport') that are not supported out of the box.
However,there is a separate support package which can help with that. Please refer to the following link to access the support package:
Note:This support package will make custom message types available in MATLAB.
Hope this helps!
댓글 수: 2
poluri koundinya
2018년 7월 25일
Hi, I have a bag file which i received from the internet and it has custom bag file. I have installed robotic system toolbox interface to read custom bag file. link:https://github.com/ouster-lidar/ouster_example#running-the-sample-ros-node but how do i download "rt_msgs ROS package" as you said? please help Regards, Nikhil
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File 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!