ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rosbag filter with erroneous messages

asked 2014-02-16 13:50:25 -0500

marsdo gravatar image


I have a bag file that contains IMU readings collected using the rosjava android sensors driver app. Apparently the rosjava implementation in the app is broken (http://, which causes issues with some ROS tools, in my case 'rosbag filter'.

Similar to the other question, I receive the following error:

  File "/opt/ros/hydro/bin/rosbag", line 35, in <module>
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosbag/", line 834, in rosbagmain
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosbag/", line 299, in filter_cmd
    for topic, raw_msg, t in inbag.read_messages(raw=True):
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosbag/", line 2062, in read_messages
    yield self.seek_and_read_message_data_record((entry.chunk_pos, entry.offset), raw)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosbag/", line 2198, in seek_and_read_message_data_record
    msg_type = _get_message_type(connection_info)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosbag/", line 1309, in _get_message_type
    message_type = genpy.dynamic.generate_dynamic(info.datatype, info.msg_def)[info.datatype]
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genpy/", line 151, in generate_dynamic
    for l in msg_generator(msg_context, spec, search_path):
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genpy/", line 736, in msg_generator
    genmsg.msg_loader.load_depends(msg_context, spec, search_path)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/", line 344, in load_depends
    return load_msg_depends(msg_context, spec, msg_search_path)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/", line 313, in load_msg_depends
    depspec = load_msg_by_type(msg_context, resolved_type, search_path)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/", line 119, in load_msg_by_type
    file_path = get_msg_file(package_name, base_type, search_path)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/", line 78, in get_msg_file
    % (base_type, package, search_path))
genmsg.msg_loader.MsgNotFound: Cannot locate message [Header]: unknown package [std_msgs] on search path [{}]

Any suggestions that would enable the filtering of the bag file would be fantastic!


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-05 15:49:10 -0500

jcerruti gravatar image

updated 2014-08-06 12:27:18 -0500

A poor workaround for this I'm using is to play the bag file with only the topics I want to keep and record them on a new bag file. Of course this only works for relatively short bag files.

In case this is useful to you, here is a way to get the list of topics from the original bag file:

topics=`rosbag info original.bag | grep "^topics" -A 9999 | grep -o ' /[^ ]*' | cut -c 2- | grep -v undesired_topic`
rosbag play original.bag --topics $topics

EDIT: The grep regex was faulty.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-02-16 13:50:25 -0500

Seen: 1,133 times

Last updated: Aug 06 '14