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.

采纳的回答

Kushagr Gupta
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.
  • 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.
Hope this helps!
  2 个评论
poluri koundinya
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
Cemre Kavvasoglu
Cemre Kavvasoglu 2019-4-26
I have same problem. Where can I find "rt_msgs ROS package"?

请先登录,再进行评论。

更多回答(0 个)

类别

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