Rostopic Throws genpy.message.DeserializationError When Echoing From a Bag File

asked 2014-07-22 10:01:54 -0500

kling gravatar image

When I attempt to echo a topic from a bag file, it fails and prints out a big error message. I have reproduced this problem on two computers. Some older bag files I have work fine.

The problem bagfiles seem to be fine otherwise. I can play the bags normally and look at them with rqt_bag. Running rosbag fix did not help.

The command I am running is:

rostopic echo -b my_bag_file.bag /my/topic

I typically use this command to extract bagged data to a CSV file, for example:

rostopic echo -b my_bag_file.bag -p /my/topic >> some_file.csv

The error message I am seeing is:

Traceback (most recent call last):
  File "/opt/ros/hydro/bin/rostopic", line 35, in <module>
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rostopic/", line 1667, in rostopicmain
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rostopic/", line 1027, in _rostopic_cmd_echo
    _rostopic_echo(topic, callback_echo, bag_file=options.bag)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rostopic/", line 672, in _rostopic_echo
    _rostopic_echo_bag(callback_echo, bag_file)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rostopic/", line 650, in _rostopic_echo_bag
    for t, msg, timestamp in b.read_messages():
  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 2210, in seek_and_read_message_data_record
  File "/tmp/genpy_Il3J3r/", line 258, in deserialize
    raise genpy.DeserializationError(e) #most likely buffer underfill
genpy.message.DeserializationError: unpack requires a string argument of length 70

Any insight is appreciated.

edit retag flag offensive close merge delete


I've occasionally seen this as well, but I don't have any leads.

ahendrix gravatar image ahendrix  ( 2014-07-22 13:50:29 -0500 )edit

Hi, have you solved this problem? I meet the same problem when I use read_message() in rosbag.

SJ gravatar image SJ  ( 2017-08-03 17:18:25 -0500 )edit