How to extract xyz from packets using dwSensorLidar_readPacket?

I will try to parse the packet read from dwSensorLidar_readPacket by referring to the samples. Because I want to convert to another xyz format.

See below code from lidar_accumulator

dwStatus status = dwSensorLidar_readPacket(&nextPacket, 1000, gLidarSensor);
            if (status == DW_SUCCESS) {
                CHECK_DW_ERROR(dwLidarAccumulator_addPacket(nextPacket, gFullLidarAccumulator));
                CHECK_DW_ERROR(dwLidarAccumulator_addPacket(nextPacket, gSectLidarAccumulator));
                CHECK_DW_ERROR(dwSensorLidar_returnPacket(nextPacket, gLidarSensor));
            }

I checked the dwLidarDecodedPacket API via doc.

  • casted to one of the point structures dwLidarPointXYZI
    So, I want to have the logic to extract xyz or casting dwLidarPointXYZI(float xyz) the (const void * points) from the dwLidarDecodedPacket.

Could you please guide to this?

Hi forgott,

Sorry that I am not quite sure about your request: " I want to have the logic to extract xyz or casting dwLidarPointXYZI(float xyz) the (const void * points) from the dwLidarDecodedPacket.".

Do you mean how to extract pure float point value from DecodedPacked?

Thank you for your comment. My question includes several things.

The first is how to cast in a programming language
like this, auto pktPts = reinterpret_cast<const dwPoint *>(nextPacket->points);
I do not want to use auto. I want to cast to the appropriate type.

The second is xyz(from dwLidarPointXYZI) a simple world coordinate? or homogeneous?

Please try with below

const float32_t *pPoints = reinterpret_cast<const float32_t*>(nextPacket->points);

For question 2, please refer to driveworks API document. I think the coordinate system is defined by what Lidar you are using.