Ask Your Question
0

rosbag filter with erroneous messages

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

marsdo gravatar image

Hi,

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:// answers.ros.org/question/108956/cannot-convert-imu-messages-from-bagfile-to-csv-file/), 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>
    rosbag.rosbagmain()
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosbag/rosbag_main.py", line 834, in rosbagmain
    cmds[cmd](argv[2:])
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosbag/rosbag_main.py", 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/bag.py", 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/bag.py", 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/bag.py", 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/dynamic.py", 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/generator.py", 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/msg_loader.py", 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/msg_loader.py", 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/msg_loader.py", 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/msg_loader.py", 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!

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

jcerruti gravatar image

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 788 times

Last updated: Aug 06 '14