Hi,
if found an empirical correlation between distance and horizontal prox value. It is a fit to a quadratic polynom function, written in integer arithmetic.
p=prox.horizontal[number]
if p>1200 then
distance=(p/331)*(p/330)-((5*p)/61)+204+80
else
distance=-1
end
The 80 at the end reflects the fact, that the corr var measured between sensor and object. But the distance here is measured from the centre of the hole (in Thymio) and the object.
And be careful the values depend on the used sensor (and maybe other things).
Here is my original data (for white,brown and black (paper) objects)
#dist #white #brown #black
0 4450 4420 3210
10 4430 4430 3200
20 4410 4290 2460
30 4120 3550 1360
40 3450 3010
50 3010 2630
60 2680 2370
70 2460 2180
80 2280 1930
90 2100 1740
100 1930 1520
110 1790 1270
120 1520
130 1330
140 1000
Basil