Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how "max points" is estimated for one-to-many proximity detection #1461

Open
matlabbe opened this issue Mar 5, 2025 · 0 comments
Open

Comments

@matlabbe
Copy link
Member

matlabbe commented Mar 5, 2025

Currently, the max points is estimated by looking at the maximum number of valid points for each assembled scan:

rtabmap/corelib/src/Memory.cpp

Lines 3343 to 3347 in 2c7aa5a

if(scan.size() > maxPoints)
{
UDEBUG("maxPoints scan(%d) = %d", iter->first, (int)scan.size());
maxPoints = scan.size();
}

Why not querying the maxPoints() member directly?

int maxPoints() const {return maxPoints_;}

If 0, then do what we did before. For 2D scans, we can compute maxPoints from the internal parameters of the 2D scan (min angle, max angle, increment).

Typical log (taken from this post), where the max points (661) of the assembled scan should be the same than the single scan (845).

[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) Memory.cpp:3188::computeIcpTransformMulti() 977 vs 895 896 897 898 899 900 901 902 903 
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 977 data(0,0,1,0,0,0,0)
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 902 data(0,0,1,0,0,0,0)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) Memory.cpp:3240::computeIcpTransformMulti() maxPoints from(977) = 536
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 895 data(0,0,1,0,0,0,0)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) Memory.cpp:3294::computeIcpTransformMulti() maxPoints scan(895) = 647
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 896 data(0,0,1,0,0,0,0)
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 897 data(0,0,1,0,0,0,0)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) Memory.cpp:3294::computeIcpTransformMulti() maxPoints scan(897) = 661
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 898 data(0,0,1,0,0,0,0)
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 899 data(0,0,1,0,0,0,0)
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 900 data(0,0,1,0,0,0,0)
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 901 data(0,0,1,0,0,0,0)
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 902 data(0,0,1,0,0,0,0)
x[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) SensorData.cpp:550::uncompressData() 903 data(0,0,1,0,0,0,0)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) Memory.cpp:3349::computeIcpTransformMulti() assembledScan=5649 points
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) LaserScan.cpp:332::init() The number of points (5649) in the scan is over the maximum points (661) defined by max points setting.
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:327::computeTransformationImpl() Guess transform = xyz=0.296851,2.423510,0.000000 rpy=0.000000,-0.000000,-1.357244
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:328::computeTransformationImpl() Voxel size=0.050000
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:329::computeTransformationImpl() PointToPlane=1
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:330::computeTransformationImpl() Normal neighborhood=5
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:331::computeTransformationImpl() Normal radius=0.000000
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:332::computeTransformationImpl() Max correspondence distance=1.000000
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:333::computeTransformationImpl() Max Iterations=50
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:334::computeTransformationImpl() Correspondence Ratio=0.200000
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:335::computeTransformationImpl() Max translation=3.000000
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:336::computeTransformationImpl() Max rotation=1.500000
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:337::computeTransformationImpl() Downsampling step=1
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:338::computeTransformationImpl() Force 3DoF=true
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:339::computeTransformationImpl() Force 4DoF=false
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:340::computeTransformationImpl() Min Complexity=0.020000
u[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:341::computeTransformationImpl() libpoint
<[rtabmap-1] matcher (knn=1, outlier ratio=0.850000)
{[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:342::computeTransformationImpl() Strategy=1
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) RegistrationIcp.cpp:351::computeTransformationImpl() size before filtering, from=5649 (format=XY, max pts=661) to=536 (format=XY, max pts=845)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) util3d_filtering.cpp:85::commonFiltering() scan size=5649 format=1, step=1, rangeMin=0.000000, rangeMax=0.000000, voxel=0.050000, normalK=5, normalRadius=0.000000, groundNormalsUp=0.000000
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.166) util3d_filtering.cpp:265::commonFiltering() Voxel filtering scan (voxel=0.050000 m): 5649 -> 1286 (scanMaxPts=661->150)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.170) LaserScan.cpp:332::init() The number of points (1286) in the scan is over the maximum points (150) defined by max points setting.
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.170) util3d_filtering.cpp:295::commonFiltering() Normals computed (k=5 radius=0.000000)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.170) util3d_filtering.cpp:85::commonFiltering() scan size=536 format=1, step=1, rangeMin=0.000000, rangeMax=0.000000, voxel=0.050000, normalK=5, normalRadius=0.000000, groundNormalsUp=0.000000
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.170) util3d_filtering.cpp:265::commonFiltering() Voxel filtering scan (voxel=0.050000 m): 536 -> 195 (scanMaxPts=845->307)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.171) util3d_filtering.cpp:295::commonFiltering() Normals computed (k=5 radius=0.000000)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.171) RegistrationIcp.cpp:446::computeTransformationImpl() size after filtering, from=1286 (format=XYNormal, max pts=150) to=195 (format=XYNormal, max pts=307), filtering time=0.004995s
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.171) RegistrationIcp.cpp:598::computeTransformationImpl() Conversion time = 0.000213 s
c[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.171) libpointmatcher.h:139::laserScanToDP() 
c[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.171) libpointmatcher.h:139::laserScanToDP() 
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.171) RegistrationIcp.cpp:613::computeTransformationImpl() libpointmatcher icp... (if there is a seg fault here, make sure all third party libraries are built with same Eigen version.)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.355) RegistrationIcp.cpp:616::computeTransformationImpl() libpointmatcher icp...done! T=xyz=0.806551,-0.883689,0.000000 rpy=0.000000,-0.000000,0.061332
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.355) RegistrationIcp.cpp:619::computeTransformationImpl() match ratio: 0.279160
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.356) RegistrationIcp.cpp:850::computeTransformationImpl() ICP (iterations=50) time = 0.184682 s
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.356) RegistrationIcp.cpp:876::computeTransformationImpl() Max scans=307 (from=150, to=307)
[rtabmap-1] [DEBUG] (2025-02-26 18:34:42.356) RegistrationIcp.cpp:896::computeTransformationImpl() 977->0 hasConverged=true, variance=0.015177, correspondences=22/307 (7.166124%), from guess: trans=1.015842 rot=0.061332

I don't think this is a big issue right now as in general the lidar used for mapping is the same used during next sessions or during localization. However, that would be an issue if the lidar max points change between mapping and localization, or during multi-session mapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant