DriveWorks SDK Reference

| 0.6.67 Release

ICP

Detailed Description

Provides functions to align a pair of pointclouds using ICP.

The module provides multiple implementation of point-to-plane ICP.

Data Structures

struct  dwICPIterationParams
 Paramter for running ICP between two frames. More...
 
struct  dwICPParams
 Parameters that control the initialization for ICP module. More...
 
struct  dwICPResultStats
 Some result stats about the most recent ICP run. More...
 

Typedefs

typedef dwBool(* dwICPConvergenceCheck) (const dwTransformation *prevSrc2Tgt, const dwTransformation *newSrc2Tgt, void *userData)
 Callback function to be executed by ICP module allowing user to overwrite default convergence criteria method. More...
 
typedef struct dwICPHandle * dwICPHandle_t
 

Enumerations

enum  dwICPType { DW_ICP_TYPE_LIDAR_POINT_CLOUD }
 

Functions

DW_API_PUBLIC dwStatus dwICP_getCUDAStream (cudaStream_t *stream, dwICPHandle_t icpObj)
 Fetches the ICP module's cuda in a pointer. More...
 
DW_API_PUBLIC dwStatus dwICP_getLastResultStats (dwICPResultStats *resultStats, dwICPHandle_t icpObj)
 Get stats about latest ICP run. More...
 
DW_API_PUBLIC dwStatus dwICP_initialize (dwICPHandle_t *icpObj, const dwICPParams *params, dwContextHandle_t ctx)
 Initializes the ICP module. More...
 
DW_API_PUBLIC dwStatus dwICP_optimize (dwTransformation *outSrc2Tgt, const dwICPIterationParams *iParams, dwICPHandle_t icpObj)
 Perform ICP between 2 pointclouds. More...
 
DW_API_PUBLIC dwStatus dwICP_release (dwICPHandle_t *icpObj)
 Releases an ICP module. More...
 
DW_API_PUBLIC dwStatus dwICP_reset (dwICPHandle_t icpObj)
 Resets the ICP module, clears any data or containers to just-initialized state. More...
 
DW_API_PUBLIC dwStatus dwICP_setConvergenceCriteriaCallback (dwICPConvergenceCheck callback, void *userData, dwICPHandle_t icpObj)
 Set callback to be executed to test convergence. More...
 
DW_API_PUBLIC dwStatus dwICP_setConvergenceTolerance (float32_t angleTol, float32_t distanceTol, dwICPHandle_t icpObj)
 Set tolerances used by the default ICP convergence criteria method. More...
 
DW_API_PUBLIC dwStatus dwICP_setCUDAStream (cudaStream_t stream, dwICPHandle_t icpObj)
 Resets the ICP module's cuda stream to new stream. More...
 
DW_API_PUBLIC dwStatus dwICP_setMaxIterations (uint16_t maxIterations, dwICPHandle_t icpObj)
 Set maximum number of iterations which need to be executed. More...
 

Data Structure Documentation

◆ dwICPIterationParams

struct dwICPIterationParams
Data Fields
const dwTransformation * initialSource2Target This column major transform will be applied to the source points before ICP is performed.

Final returned transformation will not be pre-multiplied with this

uint64_t nSourcePts Sizes of the above arrays, need to be smaller than maxPoints passed via dwICPParams to dwICP_initialize.
uint64_t nTargetPts
const dwLidarPointXYZI * sourcePts Arrays of points, sourcePts need to be transformed by the resulting dwTransformation to align to TargetPts.
const dwLidarPointXYZI * targetPts

◆ dwICPParams

struct dwICPParams
Data Fields
dwICPType icpType Type of the ICP implementation to be used.
uint32_t maxPoints Maximum number of points that will be pushed to the ICP optimization.

Depending on the implementation this number might be limited (see description of the corresponding method)

cudaStream_t stream CudaStream, all the ICP works happens in this stream, can be 0 for default stream.

◆ dwICPResultStats

struct dwICPResultStats
Data Fields
uint32_t actualNumIterations How many iterations were actually performed.
float32_t inlierFraction Fraction of points which are inliers to the final ICP pose.
float32_t rmsCost RMS (weighted) cost after last ICP iteration.

Typedef Documentation

◆ dwICPConvergenceCheck

typedef dwBool(* dwICPConvergenceCheck) (const dwTransformation *prevSrc2Tgt, const dwTransformation *newSrc2Tgt, void *userData)

Callback function to be executed by ICP module allowing user to overwrite default convergence criteria method.

The method will receive original and new transformations as computed by the ICP module

Definition at line 95 of file icp.h.

◆ dwICPHandle_t

typedef struct dwICPHandle* dwICPHandle_t

Definition at line 62 of file icp.h.

Enumeration Type Documentation

◆ dwICPType

enum dwICPType
Enumerator
DW_ICP_TYPE_LIDAR_POINT_CLOUD 

ICP implementation optimized for unstructured lidar based point clouds.

A certain corelation of the input points to their index in dwICPIterationParams::[source|target]Pts is expected for good results.

Note
This implementation supports not more than 2^15 points for source and target. If a point cloud is pushed with higher number of points, it will generate a DW_INVALID_ARGUMENT error.

Definition at line 64 of file icp.h.

Function Documentation

◆ dwICP_getCUDAStream()

DW_API_PUBLIC dwStatus dwICP_getCUDAStream ( cudaStream_t *  stream,
dwICPHandle_t  icpObj 
)

Fetches the ICP module's cuda in a pointer.

Parameters
[out]streamReturn cuda stream currently used
[in]icpObjThe initialized ICP Module to get cuda stream from.
Returns
DW_BAD_CAST - if the provided ICP handle is invalid.
. DW_INVALID_ARGUMENT - if provided parameters are invalid
DW_SUCCESS

◆ dwICP_getLastResultStats()

DW_API_PUBLIC dwStatus dwICP_getLastResultStats ( dwICPResultStats resultStats,
dwICPHandle_t  icpObj 
)

Get stats about latest ICP run.

Parameters
[out]resultStatsStruct with stats about latest ICP run
[in]icpObjThe initialized ICP Module.
Returns
DW_BAD_CAST - if the provided ICP handle is invalid.
DW_INVALID_ARGUMENT - if provided parameters are null or invalid
DW_SUCCESS

◆ dwICP_initialize()

DW_API_PUBLIC dwStatus dwICP_initialize ( dwICPHandle_t icpObj,
const dwICPParams params,
dwContextHandle_t  ctx 
)

Initializes the ICP module.

Initialization will perform any required memory allocations on GPU and CPU.

Parameters
[out]icpObjA pointer to the ICP handle for the created module.
[in]paramsParameters for initilizations.
[in]ctxSpecifies the handler to the context under which the ICP module is created.
Returns
DW_BAD_CAST - if the provided context handle is invalid.
DW_INVALID_ARGUMENT - if provided parameters are invalid
DW_SUCCESS

◆ dwICP_optimize()

DW_API_PUBLIC dwStatus dwICP_optimize ( dwTransformation *  outSrc2Tgt,
const dwICPIterationParams iParams,
dwICPHandle_t  icpObj 
)

Perform ICP between 2 pointclouds.

The method will return a transformation which aligns source points to target points.

Parameters
[out]outSrc2TgtGiven trtransformation will be overwritten with the ICP result.
[in]iParamsPointer to iteration parameters.
[in]icpObjThe initialized ICP Module.
Returns
DW_BAD_CAST - if the provided context or ICP handle is invalid.
DW_INVALID_ARGUMENT - if provided parameters are invalid
DW_SUCCESS
Note
Result returned in outSrc2Tgt will be premultiplied with the initial transformation passed in iParams. Final equation to align source to target is then targetPt = outSrc2Tgt * sourcePt

◆ dwICP_release()

DW_API_PUBLIC dwStatus dwICP_release ( dwICPHandle_t icpObj)

Releases an ICP module.

Parameters
[in]icpObjThe initialized ICP Module.
Returns
DW_BAD_CAST - if the provided ICP handle is invalid.
DW_INVALID_ARGUMENT - if provided parameters are invalid
DW_SUCCESS

◆ dwICP_reset()

DW_API_PUBLIC dwStatus dwICP_reset ( dwICPHandle_t  icpObj)

Resets the ICP module, clears any data or containers to just-initialized state.

Parameters
[in]icpObjThe initialized ICP Module to reset.
Returns
DW_BAD_CAST - if the provided ICP handle is invalid.
DW_SUCCESS

◆ dwICP_setConvergenceCriteriaCallback()

DW_API_PUBLIC dwStatus dwICP_setConvergenceCriteriaCallback ( dwICPConvergenceCheck  callback,
void *  userData,
dwICPHandle_t  icpObj 
)

Set callback to be executed to test convergence.

If nullptr, the default test will be used.

Parameters
[in]callbackMethod to execute to test for convergence
[in]userDataUser data to be passed to the convergence callback
[in]icpObjThe initialized ICP Module.
Returns
DW_BAD_CAST - if the provided ICP handle is invalid.
DW_SUCCESS

◆ dwICP_setConvergenceTolerance()

DW_API_PUBLIC dwStatus dwICP_setConvergenceTolerance ( float32_t  angleTol,
float32_t  distanceTol,
dwICPHandle_t  icpObj 
)

Set tolerances used by the default ICP convergence criteria method.

Parameters
[in]angleTolChange in radians between two consecutive iteration steps
[in]distanceTolChange in units between two consecutive iteration steps
[in]icpObjThe initialized ICP Module.
Returns
DW_BAD_CAST - if the provided ICP handle is invalid.
DW_SUCCESS
Note
both tolerances has to be fulfilled, to declare convergence (i.e. it is a binary AND).

◆ dwICP_setCUDAStream()

DW_API_PUBLIC dwStatus dwICP_setCUDAStream ( cudaStream_t  stream,
dwICPHandle_t  icpObj 
)

Resets the ICP module's cuda stream to new stream.

Parameters
[in]streamCuda stream to be used by ICP implementation.
[in]icpObjThe initialized ICP module to set stream for.
Returns
DW_BAD_CAST - if the provided ICP handle is invalid.
. DW_INVALID_ARGUMENT - if provided parameters are invalid
DW_SUCCESS

◆ dwICP_setMaxIterations()

DW_API_PUBLIC dwStatus dwICP_setMaxIterations ( uint16_t  maxIterations,
dwICPHandle_t  icpObj 
)

Set maximum number of iterations which need to be executed.

Note that ICP might converge earlier, due to the tolerances set in dwICP_setConvergenceTolerance().

Parameters
[in]maxIterationsMaximal number of iterations to execute.
[in]icpObjThe initialized ICP Module.
Returns
DW_BAD_CAST - if the provided ICP handle is invalid.
DW_SUCCESS