DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

Point Cloud Accumulator
Note
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

This tutorial demonstrates how to accumulate dwLidarDecodedPacket to a Lidar spin according to the properties specified in dwLidarProperties.

Initialize the point cloud accumulator:

params.filterWindowSize = 1;
params.minAngleDegree = -180.f;
params.maxAngleDegree = 180.f;
params.minDistanceMeter = 0.f;
params.maxDistanceMeter = FLT_MAX;
params.memoryType = DW_MEMORY_TYPE_CUDA;
params.organized = true;
params.enableMotionCompensation = false;
dwPointCloudAccumulator_initialize(&accumulator, &params, lidarProperties, context);

filterWinSize specifies the horizontal smoothing for the Lidar sweep to reduce the horizontal jitter inherent to the Lidar rotating units. It must be set to be the power of 2 whose exponent ranges from 0 to 4. When set to values other than 1, the Lidar point whose 3D distance is the closest to the Lidar sensor is selected in the horizontal window.

minAngleDegree, maxAngleDegree parameters specify angle range to accumulate points. By default the module returns full 360-degree Lidar sweep.

minDistanceMeter, maxDistanceMeter parameters allows to customize the range of distance in a 360-degree Lidar sweep.

params.type specifies whether the accumulator works on CPU or GPU.

User can also set params.memoryType = DW_MEMORY_TYPE_CPU if CPU memory is expected. Organized point cloud resemble 2D grid which can be indexed by row and column. The organized nature brings up neighborhood relationship which could reduce computational costs for certain tasks. If params.organized = false, such neighborhood relationship is not maintained in the accumulated point cloud. If params.enableMotionCompensation = true, the accumulator will correct the motion distortion during the packet collection. User must initialize params.egomotion with valid egomotion handle. See Relative Egomotion Workflow for egomotion usecase.

The sample specifies CUDA memory in the initialization, user is assumed to allocate CUDA memory to store the output, bind the buffer to the module and set the proper CUDA stream

dwPointCloudAccumulator_bindOutput(&accumulatedSpin, accumulator);

To continuously collect the decoded lidar packet until is reaches the packets per spin specified in dwLidarProperties:

bool hasFullSpinReady = false;
dwPointCloudAccumulator_isReady(&hasFullSpinReady, accumulator);
while (!hasFullSpinReady)
{
// get decoded lidar packet
......
dwPointCloudAccumulator_addLidarPacket(lidarPacket, accumulator);
dwPointCloudAccumulator_isReady(&hasFullSpinReady, accumulator);
}
cudaStreamSynchronize(stream);
// use accumulatedSpin for other tasks
......

To release the module:

Note
output buffer accumulatedSpin should have the same memory type as params.memoryType.

For more details see Point Cloud Processing Sample