Finding the middle of jar with optical sensor on gripper fingers

Hi guys!

I’ve got a question about a centering application. I appreciate all your help!
appreciate all your help!
I have a UR10 e-Series and an RG2 gripper on it. There’s an optical sensor on the fingertips. I have to identify the center of a transparent glass jar, without touching it.
The problem:
When I start the centering with the jaws open:
1.) Move sideways towards the jar, I get the first “HI” state from the sensor. (get_actual_tcp)
2.) Move further until I wait for the ‘LO’ status at the end of the neck of the jar. (get_actual_tcp)

The problem is that I get false ‘LO’ status because of the transparency of the jar. What sequence should I use to consider only the last ‘LO’ signal, instead of the current one?

Thanks a lot in advance!

I’m assuming the jars are all different sizes, otherwise you could just move a fixed amount after the first high signal.

Does the signal ever go HIGH again as you scan across the part? Maybe when it reaches the very end? Otherwise I’m not sure it’s going to be possible with that current sensor if it sees through the jar and calls it low