cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L5CX: Should I change Sharpener for my use case? How can I tune it?

DWang.7
Associate III

Is the default value of 5% recommended for most indoor use cases?

4 REPLIES 4
John E KVAM
ST Employee

That's a tough one to answer definitively. My rule of thumb is whatever works, works.

But that is not very satisfying.

When a bunch of photons hit the lens, most go right through and the sensor detect the target. But some blurring is unavoidable. This effect is most evident with very near targets returning a lot of photons. The trick is to find those zones that have the same distance as a neighbor, but with a MUCH smaller returning signal. But how much smaller.

That 5% basically says, 'if a zone has the same distance as it's neighbor but with only 5% of the signal strength, then the edge of the target is so close to the zone edge, that we should just call it outside the zone.

If life were perfect all target edges would be on a zone boundary. But with blurring and the fact that an object edge might be just a few mm inside a zone, it's logical to square up the boundaries.

But how much squaring is up to you. My experiments show 5-7% seems about right. Might want less if targets are far away, a bit more if you are mostly looking at near targets.

  • john

Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'

Hi John,

Thank you for the detailed explanation. It helps me a lot.

Wayne

MFabb.1
Associate II

Hi,

The default sharpener value (14% on the latest ULD driver) is higher than the 5-7% recommended above.

Could you confirm that 14% returned by the function vl53l5cx_get_sharpener_percent is a "real" 14%?

I ask that because our SW team found a conversion/precision error between percentage and byte value in the functions vl53l5cx_get_sharpener_percent() and vl53l5cx_set_sharpener_percent() in the ULD driver (version 1.3.4 - unchanged in 1.3.6):

uint8_t vl53l5cx_get_sharpener_percent(
		VL53L5CX_Configuration		*p_dev,
		uint8_t				*p_sharpener_percent)
{
	uint8_t status = VL53L5CX_STATUS_OK;
 
	status |= vl53l5cx_dci_read_data(p_dev,p_dev->temp_buffer,
			VL53L5CX_DCI_SHARPENER, 16);
 
	*p_sharpener_percent = (p_dev->temp_buffer[0xD]
                                *(uint8_t)100)/(uint8_t)255;
 
	return status;
}
 
uint8_t vl53l5cx_set_sharpener_percent(
		VL53L5CX_Configuration		*p_dev,
		uint8_t				sharpener_percent)
{
	uint8_t status = VL53L5CX_STATUS_OK;
        uint8_t sharpener;
 
	if(sharpener_percent >= (uint8_t)100)
	{
		status |= VL53L5CX_STATUS_INVALID_PARAM;
	}
	else
	{
		sharpener = (sharpener_percent*(uint8_t)255)/(uint8_t)100;
		status |= vl53l5cx_dci_replace_data(p_dev, p_dev->temp_buffer,
				VL53L5CX_DCI_SHARPENER, 16,
                                (uint8_t*)&sharpener, 1, 0xD);
	}
 
	return status;
}

The resolution of the set/get seems 3% due to the conversion from byte value to percentage value.

A simple test to show the bug would be to run this pseudo code:

vl53l5cx_set_sharpener_percent(14)
s = vl53l5cx_get_sharpener_percent()

The value s returned from the get function will be 13 and not 14 as expected. Similar behavior will recur with different values passed to the set function.

Please, could you check that?

Thank you

John E KVAM
ST Employee

the percentage was put in to make it easier for the user. Apparently the coder was having a hard time discribing the range between a 0-255 and so they used percentage.

And trying to avoid floating point numbers, you get that +/- 1 effect.

To the accuracy of the algo, that 1 percent is not going to make a difference.

I like my sharpener closer to 7%. I feel it makes the objects - well - sharper. But it takes some playing with and experiment by the user in your application.

The sharper accounts for the fact that bright objects reflect photons in the neighboing zones. So to counter this effect, the code discounts targets that have less than 7% (or whatever you choose) of the signal of their neighbor and have the same distance.

The data is still there - but it's marked by a status 12. 12 means the target is likely a result of this bluring effect.


Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'