rosbag.bag.ROSBagFormatException: Error reading header: expecting 606348583 bytes, read 871518

asked 2019-11-12 23:24:53 -0600

srinivast6 gravatar image

I am trying to create an UI interface where all the videos in ROS bag file will be played simultaneously. For this I have used threading concept like each thread for each video.

I am able to play all videos , but while playing the following error is thrown stopping the play. Where I am doing Wrong?

  class Main(QMainWindow):

...
...

    class videoThread(QtCore.QThread):


        def __init__(self,topic,bag,label):
          super().__init__()
          self.bag = bag
          self.topic = topic
          self.label = label
     def run(self):
         bridge = CvBridge()


        for topic, msg, t in self.bag.read_messages(topics=[self.topic]):
              img_dcam = bridge.compressed_imgmsg_to_cv2(msg, desired_encoding="passthrough")

              rgbImage = cv2.cvtColor(img_dcam, cv2.COLOR_BGR2RGB)

              convertToQtFormat = QImage(rgbImage.data, rgbImage.shape[1], rgbImage.shape[0],
                                   QImage.Format_RGB888)
              convertToQtFormat = QPixmap.fromImage(convertToQtFormat)
              pixmap = QPixmap(convertToQtFormat)
              resizeImage = pixmap.scaled(300, 300, Qt.KeepAspectRatio)
              self.label.setPixmap(resizeImage)
              time.sleep(0.033)


    def playVideo(self,topic):
         self.x = self.videoThread(topic,self.bag,self.label)
         self.x.start()

Traceback (most recent call last):
File "rosmanager_main.py", line 1276, in run
for topic, msg, t in self.bag.read_messages(topics=[self.topic]):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 2679, in read_messages
yield self.seek_and_read_message_data_record((entry.chunk_pos, entry.offset), raw, return_connection_header)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 2826, in  seek_and_read_message_data_record
header = _read_header(f)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 1999, in _read_header
raise ROSBagFormatException('Error reading header: %s' % str(ex))
rosbag.bag.ROSBagFormatException: Error reading header: expecting 606348583 bytes, read 871518
edit retag flag offensive close merge delete