0
$\begingroup$

Rosanswers logo

Hello all,

I get the following error message when parsing a bag file with rosbag API when there is a message of type Int16MultiArray: "Cannot locate message [MultiArrayLayout]: unknown package [std_msgs] on search path [{}]."

Here is the code to parse the bag:

import roslib; roslib.load_manifest('rosbag'); roslib.load_manifest('std_msgs'); 
from std_msgs.msg import Int32, String, Int16MultiArray 
from std_msgs.msg import MultiArrayLayout, MultiArrayDimension 
for topic, msg, t in bag:   
    #do stuff here

As you can see, I include the type that I need (Int16MultiArray) and also it's subtypes (MultiArrayLayout and MultiArrayDimension), but I still get the error. Below is some stack trace.

Traceback (most recent call last):
  File "PowerTransferSensorPositionAnalysis.py", line 163, in <module>
    main()
  File "PowerTransferSensorPositionAnalysis.py", line 53, in main
    for topic, msg, t in bag:
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/rosbag/bag.py", line 2062, in read_messages
    yield self.seek_and_read_message_data_record((entry.chunk_pos, entry.offset), raw)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/rosbag/bag.py", line 2198, in seek_and_read_message_data_record
    msg_type = _get_message_type(connection_info)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/rosbag/bag.py", line 1309, in _get_message_type
    message_type = genpy.dynamic.generate_dynamic(info.datatype, info.msg_def)[info.datatype]
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genpy/dynamic.py", line 151, in generate_dynamic
    for l in msg_generator(msg_context, spec, search_path):
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genpy/generator.py", line 725, in msg_generator
    genmsg.msg_loader.load_depends(msg_context, spec, search_path)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 344, in load_depends
    return load_msg_depends(msg_context, spec, msg_search_path)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 313, in load_msg_depends
    depspec = load_msg_by_type(msg_context, resolved_type, search_path)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 119, in load_msg_by_type
    file_path = get_msg_file(package_name, base_type, search_path)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 78, in get_msg_file
    % (base_type, package, search_path))

Thanks for the help

Edit: I should also note that the same error happens when opening the bag with rxbag.


Originally posted by amittleider on ROS Answers with karma: 227 on 2013-03-13

Post score: 0


Original comments

Comment by btakac on 2013-04-02:
Hello! I have a very similar problem, with the same traceback. On Fuerte on Ubuntu 12.04 LTS. Final msg: MsgNotFound: Cannot locate message [Header]: unknown package [std_msgs] on search path [{}] Is there known solution?

Comment by amittleider on 2013-04-07:
I still have not found a solution (but haven't been looking too hard). It is quite an annoying problem for me.. I had to hack the feature in for now by converting them to a string, publishing, then parsing the string on the other side.

Comment by PeterMilani on 2013-06-21:
Are you using ROSJAva, I get this error for messages published from ROSJava nodes. I am thinking to implement a cpp node to rebroadcast these messages to rosbag and see if it makes a difference

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

A workaround if you are having problems with ROSJava messages and rosbag, Is to write an efficient cpp node that subscribes to the ROSJava messages you want to store and republishes on topics to rosbag using a roscpp publisher. I had been getting similar errors using Rosbag to subscribe to ROSJava messages. This allowed me to save my ROSJAVA message traffic in a bag file.

Hope this helps


Originally posted by PeterMilani with karma: 1493 on 2013-06-21

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by amittleider on 2013-08-11:
Thanks. This definitely fixes the problem, but it seems odd that rosbag and rosjava don't work well together when rospy and rosjava work perfectly fine. I implemented this fix for all of my *MultiArrayLayout messages. The other message types in std_msgs work without the fix.

Comment by Teny on 2013-11-21:
Could you guys explain how to fix this? I have several bag files that have some topics subscribed from android ros. I think it's matter of ROSJava but have no idea how to fix it. It there any way to fix the bag files to see on rqt_bag or rxbag? I'm a very beginner.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.