Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rosbag message headers missing dependency information from rosjava #39

Open
jacknlliu opened this issue May 15, 2018 · 0 comments
Open

Comments

@jacknlliu
Copy link
Owner

We record the topics from rosjava using rosbag

rosbag record -O test.bag '/iiwa/joint_states'

Then we use rostopic to convert the bag to csv file

rostopic echo -b test.bag -p '/iiwa/joint_states' > joint_states.txt 

But we get the following errors:

Traceback (most recent call last):
  File "/opt/ros/kinetic/bin/rostopic", line 35, in <module>
    rostopic.rostopicmain()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rostopic/__init__.py", line 2093, in rostopicmain
    _rostopic_cmd_echo(argv)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rostopic/__init__.py", line 1392, in _rostopic_cmd_echo
    _rostopic_echo(topic, callback_echo, bag_file=options.bag)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rostopic/__init__.py", line 1013, in _rostopic_echo
    _rostopic_echo_bag(callback_echo, bag_file)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rostopic/__init__.py", line 991, in _rostopic_echo_bag
    for t, msg, timestamp in b.read_messages():
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosbag/bag.py", line 2337, in read_messages
    yield self.seek_and_read_message_data_record((entry.chunk_pos, entry.offset), raw)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosbag/bag.py", line 2475, in seek_and_read_message_data_record
    msg_type = _get_message_type(connection_info)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosbag/bag.py", line 1571, in _get_message_type
    message_type = genpy.dynamic.generate_dynamic(info.datatype, info.msg_def)[info.datatype]
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genpy/dynamic.py", line 155, in generate_dynamic
    for l in msg_generator(msg_context, spec, search_path):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genpy/generator.py", line 741, in msg_generator
    genmsg.msg_loader.load_depends(msg_context, spec, search_path)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 349, in load_depends
    return load_msg_depends(msg_context, spec, msg_search_path)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 318, in load_msg_depends
    depspec = load_msg_by_type(msg_context, resolved_type, search_path)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 124, in load_msg_by_type
    file_path = get_msg_file(package_name, base_type, search_path)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 83, in get_msg_file
    % (base_type, package, search_path), base_type, package, search_path)
genmsg.msg_loader.MsgNotFound: Cannot locate message [Header]: unknown package [std_msgs] on search path [{}]

It looks like rosjava is not publishing the full message definition correctly.

rostopic echo -b test.bag ...

The rostopic echo -b can't solve the dynamic message types.

And if we play the bag file, and then using rostopic echo to save the topic, it works.

rosbag play test.bag

rostopic echo -p '/iiwa/joint_states' > joint_states.txt

A workaround, please see rosbag_fixer, and we can use this python script to convert the rosbag to a normal rosbag file.

system information:
Ubuntu 16.04 
ROS kinetic
ros bag: 1.12.12-0xenial-20171116-225733-0800
rostopic: 1.12.12-0xenial-20171116-231053-0800

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant