- 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 views (last 30 days)
Show older comments
Fadi Al Khoury
on 13 Mar 2017
Commented: Cemre Kavvasoglu
on 26 Apr 2019
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 Comments
Accepted Answer
Kushagr Gupta
on 16 Mar 2017
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 Comments
poluri koundinya
on 25 Jul 2018
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
More Answers (0)
See Also
Categories
Find more on ROS Log Files and Transformations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!