laboshinl / loam_velodyne

Laser Odometry and Mapping (Loam) is a realtime method for state estimation and mapping using a 3D lidar.
http://wiki.ros.org/loam_velodyne
Other
1.71k stars 952 forks source link

Bug? the for loop upper bound is not correct when search corner point in last sweep #124

Open Bzhnja opened 5 years ago

Bzhnja commented 5 years ago

I don't know if it should be a bug, so I post this issue to talk about it.

https://github.com/laboshinl/loam_velodyne/blob/25db5dd5b2c135e779a50a11af0a53434598df7e/src/lib/BasicLaserOdometry.cpp#L262

When try to find the feature correspondence, it try to search the second closest corner point in _lastCornerCloud. But the variable cornerPointsSharpNum is not the size of _lastCornerCloud, the real size of _lastCornerCloud is much larger than cornerPointsSharpNum. It is the Less Sharp Points Num, but not Sharp Points Number.

for (int j = closestPointInd + 1; j < cornerPointsSharpNum; j++)

should change to

for (int j = closestPointInd + 1; j < _lastCornerCloud->points.size(); j++)

Timetravellerqin commented 5 years ago

Hey, dude. I agree with your finding. This "for" loop won't serve the purpose. If you have any further interesting conclusion, please keep me posted.