[Solved] kitt2bag Error: Failed to find match for field intensity

Problem analysis: this problem usually occurs when the point cloud type with intensity field (such as PointXYZI) is used to load the point cloud without intensity information. The point cloud data structure downloaded from Kitti data set is (x, y, Z, I) which contains intensity information, so the above problem may be caused by the loss of point cloud intensity information when bin file is converted to bag file?

Solution:

  1. Modify kitti2bag.
  2. Generate new bag.

Modification steps:

enter whereis kitti2bag in the terminal to find the path of the file.

whereis kitti2bag

Open the file vim/gedit in this path and change ‘i’ to ‘intensity’

Modified
        # fill pcl msg
        fields = [PointField('x', 0, PointField.FLOAT32, 1),
                  PointField('y', 4, PointField.FLOAT32, 1),
                  PointField('z', 8, PointField.FLOAT32, 1),
                  PointField('intensity', 12, PointField.FLOAT32, 1)]
        pcl_msg = pcl2.create_cloud(header, fields, scan)

#Before
        # fill pcl msg
        fields = [PointField('x', 0, PointField.FLOAT32, 1),
                  PointField('y', 4, PointField.FLOAT32, 1),
                  PointField('z', 8, PointField.FLOAT32, 1),
                  PointField('i', 12, PointField.FLOAT32, 1)]
        pcl_msg = pcl2.create_cloud(header, fields, scan)i

Re-convert bag file.

Read More: