minwoo0611 / MA-LIO

Asynchronous Multiple LiDAR-Inertial Odometry using Point-wise Inter-LiDAR Uncertainty Propagation
GNU General Public License v2.0
287 stars 36 forks source link

fix termination condition in for loop #6

Closed lnexenl closed 11 months ago

lnexenl commented 11 months ago

size() method return value with type size_t, which is an unsigned type. When kf.lidar_uncertainty[num].size() == 0, kf.lidar_uncertainty[num].size() - 1 overflows, leading this expression to a very large number (e.g. 2^64-1). This might make the loop executes wrongly. A forced typecasting will fix this problem.

minwoo0611 commented 11 months ago

Thank you for your great advise!

It seems be a good suggestion for stability of MA-LIO.

I merge this pull request, and again, thank you for your suggestion.

Best,