TixiaoShan/LIO-SAM

[QUESTION] - What information does cloudInfo.startRingIndex and cloudInfo.endRingIndex encode?

Closed this issue · 3 comments

Hi, my name is Alonso and I'm currently developping my Master Thesis.

To do so, I need to fully understand this code, so here it goes my question.

In the imageProjection.cpp file, inside the cloudExtraction() function, we see that the cloudInfo message is filled.

       // extract segmented cloud for lidar odometry
       for (int i = 0; i < N_SCAN; ++i)
       {
           cloudInfo.startRingIndex[i] = count - 1 + 5; // Debug: Why +4? --> Skipping first layers?? :S

           for (int j = 0; j < Horizon_SCAN; ++j)
           {
               if (rangeMat.at<float>(i,j) != FLT_MAX)
               {
                   // mark the points' column index for marking occlusion later
                   cloudInfo.pointColInd[count] = j;
                   // save range info
                   cloudInfo.pointRange[count] = rangeMat.at<float>(i,j);
                   // save extracted cloud
                   extractedCloud->push_back(fullCloud->points[j + i*Horizon_SCAN]); // Debug: Only valid range points within the pointcloud is extracted to publish.
                   // size of extracted cloud
                   ++count;
               }
           }
           cloudInfo.endRingIndex[i] = count -1 - 5; // Debug: Don't get it
       }

Concretely, I don't understand why for assigning the cloudInfo.startRingIndex and cloudInfo.endRingIndex, we do this strange operation of count - 1 + 5 and count - 1 - 5, respectively.

Can anyone guide me here?

Thank you! 👍

The -1 accounts for the difference between a count and a zero-based index. If you want to index the first element, its index is 0.

If i recall correctly, the +-5=10 points are due to the feature extraction algorithm from (LeGO-)LOAM, as seen in the LeGO-LOAM Paper from Shan and Englot (2018), Section C.

Let S be the set of continuous points of p_i from the same row of the range image. Half of the points in S are on either side of pi. In this paper, we set |S| to 10.

Also, note that extractedCloud is a flat array. start-/ and endRingIndex indicate where a particular ring i starts and ends, with 5 points margin to each side.

Thank you very much for the quick response! It was very helpful 👍