This tutorial demonstrates how to accumulate dwLidarDecodedPacketEx
to a lidar spin point cloud.
Create point cloud assembler module:
params.mapping.numLayers = 3;
params.mapping.numAuxChannels = 3;
DW_API_PUBLIC dwStatus dwSensorLidar_getProperties(dwLidarProperties *const lidarProperties, dwSensorHandle_t const sensor)
Gets information about the Lidar sensor.
@ DW_LIDAR_AUX_DATA_TYPE_LINEID
LINEID type.
@ DW_LIDAR_AUX_DATA_TYPE_TIME
TIME type.
@ DW_LIDAR_AUX_DATA_TYPE_NOISELEVEL
NOISELEVEL type.
@ DW_LIDAR_RETURN_TYPE_FIRST
@ DW_LIDAR_RETURN_TYPE_STRONGEST
@ DW_LIDAR_RETURN_TYPE_LAST
Defines the properties of the lidar.
bool enableCuda
If set to true, assembling to GPU memory.
DW_API_PUBLIC dwStatus dwPointCloudAssembler_initialize(dwPointCloudAssemblerHandle_t *const obj, dwPointCloudAssemblerParams const *const params, dwLidarProperties const *const lidarProperties, dwContextHandle_t const ctx)
Initialize point cloud assembler module.
struct dwPointCloudAssemblerObject * dwPointCloudAssemblerHandle_t
Initialization parameters.
Create output point cloud and bind it to assembler.
uint32_t
const numAvailableReturns = lidarProps.availableReturns !=
DW_LIDAR_RETURN_TYPE_ANY ?
static_cast<uint32_t
>(std::bitset<32U>(lidarProps.availableReturns).count()) : 1U;
uint32_t const pointsPerLayer = lidarProps.pointsPerSpin / numAvailableReturns;
uint32_t const auxChannelElementSizes[] = {
sizeof(uint16_t),
};
pointsPerLayer,
3U,
auxChannelElementSizes,
3U);
float float32_t
Specifies POD types.
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
@ DW_LIDAR_RETURN_TYPE_ANY
DW_API_PUBLIC dwStatus dwPointCloud_create(dwPointCloud *pointCloud, dwPointCloudFormat const format, dwMemoryType const memoryType, uint32_t const maxPointsPerLayer, uint32_t const numRequestedLayers, uint32_t const *auxChannelsElemSize, uint32_t const numRequestedAuxChannels)
Create point cloud with layers and aux channel information.
DW_API_PUBLIC dwStatus dwPointCloudAssembler_setCUDAStream(cudaStream_t const stream, dwPointCloudAssemblerHandle_t const obj)
Set CUDA stream of point cloud assembler.
DW_API_PUBLIC dwStatus dwPointCloudAssembler_bindOutput(dwPointCloud *const pointCloud, dwPointCloudAssemblerHandle_t const obj)
Bind output point cloud.
@ DW_POINTCLOUD_FORMAT_XYZI
Cartesian 3D coordinate + intensity.
Defines point cloud data structure.
To continuously collect the decoded lidar packet until it reaches the scanComplete
flag:
bool hasFullSpinReady = false;
while (!hasFullSpinReady)
{
dwSensorLidar_readPacektEx(&lidarPacket, sensor);
}
......
DW_API_PUBLIC dwStatus dwPointCloudAssembler_addLidarPacket(dwLidarDecodedPacket const *const packet, dwPointCloudAssemblerHandle_t const obj)
Push lidar packet to point cloud assembler.
DW_API_PUBLIC dwStatus dwPointCloudAssembler_process(dwPointCloudAssemblerHandle_t const obj)
Perform processing of accumulated data.
DW_API_PUBLIC dwStatus dwPointCloudAssembler_isReady(bool *const isReady, dwPointCloudAssemblerConstHandle_t const obj)
Indicate that lidar frame has been accumulated.
Release the module:
DW_API_PUBLIC dwStatus dwPointCloud_destroy(dwPointCloud *pointCloud)
Destroy point cloud buffers.
DW_API_PUBLIC dwStatus dwPointCloudAssembler_release(dwPointCloudAssemblerHandle_t const obj)
Release point cloud assembler.