The SLAMICP library performs Iterative Closest Point matching focused on mobile robot self-localization and map creation based on LIDAR data.

The Iterative Closest Point (ICP) is a matching technique used to determine the transformation matrix that minimizes the distance between point clouds.

Example calls to the SLAMICP library using a MATLAB wrapper ( includded in the library as a precompiled MEX file for Windows®):

>> [ P_{i} ] = SLAMICP( M, T_{i}, inlier_{threshold}, method, maxiter, P_{i-1}, N, Outlier_{threshold} );

The parameters used in the calls are:

M, is the point cloud defining the map of the environment.

T_{i}, is the point cloud defining the i'th LIDAR scan that will be matched with the map M.

M_{i}, is the map updated with the information included in the scan T_{i}

M_{i-1}, is the map before incorporating the new information included in the scan T_{i}

inlier_{threshold}, is the threshold distance applied to the matched points to classify a point as an inlier (used by the ICP matching), default = 0.3 units

method, the valid ICP methods are: 'point_to_point' or 'point_to_plane' (faster if the normals N are provided)

maxiter, is the maximum number of iterations allowed during the ICP matching

P, is the current position and orientation of the mobile robot in the map M expressed as: P = ( x, y, θ )

P_{i}, is the current position of the mobile robot in the map M expressed as: P_{i} = ( x_{i}, y_{i}, θ_{i} )

P_{i-1}, is the initial guess of P_{i}, it describes the previous position and orientation of the mobile robot updated with the information of the encoders (if available)

N, are the normals of the map M (use N = [] if the normals are unknown or not used)

N_{i}, are the normals of the map M_{i}

N_{i-1}, are the normals of the map M_{i-1} (use N_{i-1} = [] if the normals are unknown or not used)

Outlier_{threshold}, is the threshold distance applied to the matched points to classify a point of tT_{i} as an outlier (does not affect the ICP matching), default = 0.3 units

niter, is the number of iterations performed during ICP matching

md, is the mean inlier distance (computed from the distance between the matched (inlier) points)

O_{index}, are the index of the points of T_{i} classified as outliers

O_{coords}, are the coordinates of the outliers expressed in the coordinates of M (transformed outliers)

tT_{i}, is the current (i'th) LIDAR scan (T_{i}) expressed in the coordinates of M (transformed LIDAR scan)

Representation of example input ( M_{i-1}, T_{i} ) and output ( tT_{i}, M_{i} ) 2D point clouds:

Based on the LIBICP

The SLAMICP library is based on the LIBICP (LIBrary for Iterative Closest Point fitting) which is a cross-platfrom C++ library with MATLAB wrappers for fitting 2d or 3d point clouds with respect to each other. Currently it implements the SVD-based point-to-point algorithm as well as the linearized point-to-plane algorithm. It also supports outlier rejection and is accelerated by the use of k-d trees as well as a coarse matching stage using only a subset of all points.
Compared with the LIBICP, the SLAMICP returns the number of iterations, the mean inlier distance, the outliers, the transformed point cloud and the updated map.

The SLAMICP function computes the transformation (P_{i}) that aligns the input point cloud (T_{i}) with a reference point cloud (M).
This version is faster when using the method 'point_to_plane' when the normals (N) are precomputed.
A MATLAB wrapper is provided as precompiled MEX file for Windows®.

Example MATLAB calls for method = 'point_to_plane'

% Precomputation of the normals N of a (already built) map M >>N = SLAMICP(M);

% Call to match T_{i} with M_{i-1} and update the map M_{i} and the normals N_{i}, faster, ideal for Simultaneous Localization And Mapping (SLAM)
>> [ P_{i}, niter, md, O_{indx}, O_{coords}, tT_{i}, M_{i}, N_{i} ] = SLAMICP( M_{i-1}, T_{i}, inlier_{threshold}, method, maxiter, P_{i-1}, N_{i-1}, Outlier_{threshold} );

% Call to match T_{i} with M_{i-1} and update the map M_{i} (slowest, the normals are computed on each call)
>> [ P_{i}, niter, md, O_{indx}, O_{coords}, tT_{i}, M_{i} ] = SLAMICP( M_{i-1}, T_{i}, inlier_{threshold}, method, maxiter, P_{i-1}, [], Outlier_{threshold} );

% Call to match T_{i} with M without updating the map (faster), ideal for self-localization
>> [ P_{i}, niter, md, O_{indx}, O_{coords}, tT_{i} ] = SLAMICP( M, T_{i}, inlier_{threshold}, method, maxiter, P_{i-1}, N, Outlier_{threshold} );

% Call to match T_{i} with M without updating the map (slower, the normals are computed on each call)
>> [ P_{i}, niter, md, O_{indx}, O_{coords}, tT_{i} ] = SLAMICP( M, T_{i}, inlier_{threshold}, method, maxiter, P_{i-1}, [], Outlier_{threshold} );

>>P_{i} = SLAMICP( M, T_{i}, inlier_{threshold}, method, maxiter, P_{i-1}, N); % fastest, ideal for mobile robot self-localization using a map M and its normals N, P_{i} = ( x_{i}, y_{i}, θ_{i} ) >>P_{i} = SLAMICP( M, T_{i}, inlier_{threshold}, method, maxiter, P_{i-1}, []); % performing mobile robot self-localization, P_{i} = ( x_{i}, y_{i}, θ_{i} )

% Display the help and usage instructions
>> SLAMICP( );

% Obtain the outliers of tT_{i} (transformed T_{i} according to P_{i} ), matching and merging only the outliers of tT_{i} (listed in O_{coords} ) with M_{i-1} (no ICP iterations) to create M_{i} >> [ ~, ~, ~, O_{index}, O_{coords}, tT_{i}, M_{i} ] = SLAMICP( M_{i-1}, T_{i}, inlier_{threshold}, method, 0, P_{i}, Outlier_{threshold} );

% Obtain the outliers of tT_{i} (transformed T_{i} according to P_{i} )
>> [ ~, ~, ~, O_{index}, O_{coords}, tT_{i} ] = SLAMICP( M, T_{i}, inlier_{threshold}, method, 0, P_{i}, Outlier_{threshold} );

% Obtain tT_{i} (transformed T_{i} according to P_{i} ) and merge all points of tT_{i} (all are outliers because Outlier_{threshold} = 0 ) with M_{i-1} (no ICP iterations) to create M_{i} >> [ ~, ~, ~, O_{index}, O_{coords}, tT_{i}, M_{i} ] = SLAMICP( M_{i-1}, T_{i}, 0, method, 0, P_{i}, 0 );

The PCMerge function applies a transformation to the current LIDAR scan (T_{i}) and merges the result with the reference point cloud (M_{i-1}).
A MATLAB wrapper is provided as precompiled MEX file for Windows®.

Example MATLAB calls

% Create an updated map M_{i} : 1) transform T_{i} using P_{i} = ( x_{i}, y_{i}, θ_{i} ) obtained with SLAMICP and 2) merge the result with the original map M_{i-1} >> [ M_{i}, tT_{i} ] = PCMerge( M_{i-1}, T_{i}, P_{i} ); >>M_{i} = PCMerge( M_{i-1}, T_{i}, P_{i} );

% Create an updated map M_{i} : 1) transform T_{i} using Tr_{fit} = ( R( θ ), t ) obtained with LIBICP and 2) merge the result with the original map M_{i-1} >> [ M_{i}, tT_{i} ] = PCMerge( M_{i-1}, T_{i}, Tr_{fit} ); >>M_{i} = PCMerge( M_{i-1}, T_{i}, Tr_{fit} );

The ComputeNormals function computes the normals of a point cloud.
A MATLAB wrapper is provided as precompiled MEX file for Windows®.

Example MATLAB call

% Optimized computation of the normals N (red arrows) of a map M (blue dots)
>>N = ComputeNormals(M, Neighbours); >>N = ComputeNormals(M); % Neighbours = 10 by default

The SLAMICP function computes the transformation (P_{i}) that aligns the input point cloud (T_{i}) with a reference point cloud (M).
A MATLAB wrapper is provided as precompiled MEX file for Windows®.

% Display the help and usage instructions
>> SLAMICP( );

% Obtain the outliers of tT_{i} (transformed T_{i} according to P_{i} ), matching and merging only the outliers of tT_{i} (listed in O_{coords} ) with M_{i-1} (no ICP iterations) to create M_{i} >> [ ~, ~, ~, O_{index}, O_{coords}, tT_{i}, M_{i} ] = SLAMICP( M_{i-1}, T_{i}, inlier_{threshold}, method, 0, P_{i}, Outlier_{threshold} );

% Obtain the outliers of tT_{i} (transformed T_{i} according to P_{i} )
>> [ ~, ~, ~, O_{index}, O_{coords}, tT_{i} ] = SLAMICP( M, T_{i}, inlier_{threshold}, method, 0, P_{i}, Outlier_{threshold} );

% Obtain tT_{i} (transformed T_{i} according to P_{i} ) and merge all points of tT_{i} (all are outliers because Outlier_{threshold} = 0 ) with M_{i-1} (no ICP iterations) to create M_{i} >> [ ~, ~, ~, O_{index}, O_{coords}, tT_{i}, M_{i} ] = SLAMICP( M_{i-1}, T_{i}, 0, method, 0, P_{i}, 0 );