YDLIDAR/YDLidar-SDK

Incorrect computation of intensity value?

ecourtois opened this issue · 0 comments

Hello,

First of all, thanks for this very complete SDK!
I am using a YDLidar G2 device. I cannot get a correct intensity value.
Here is what I found in the source code:

In CYdLidar class, there is a member m_IntensityBit that can be set using setlidaropt and defaults to 10.
Depending on the device type, there can be no intensity value, or intensity value on 8 or 10 bits.

However, in YDlidarDriver class, there is also a member m_intensityBit, but it does not seem to be linked to the same member in CYdLidar.

In YDlidarDriver::getIntensityFlag(), called from YDlidarDriver::startScan(), m_intensityBit can be set to 0 or 8, but never to 10.

So in YDlidarDriver::parseNodeFromeBuffer(), the 2 upper intensity bit coming from the distance register are never used.

With a YDLidar G2 which has 10-bit intensity value, if the intensity becomes greater than 255, it returns to 0 whereas it should continue to increase until 1024.

Is my understanding correct or did I missing something to get the correct intensity value?