Sharp GP2D12 and Object Detection

Hi all,

 

I'm trying to use 2 sharp sensors to detect an object which is placed near a wall (see pic). The problem with these sensors is that the readings will fluctuate even when it's static and if the distance is far, it is harder to differentiate the object from the wall.

Sharp_Sensor.jpg

the sensors are mounted on a moving robot. Any suggestions to detect the object?

I played around with adding

I played around with adding a cap to the signal and ground since it’s an analogue device. Seemed to help somewhat in the eratic reading if I recall correctly. I played around with different sizes but don’t recall which I ended up using. 100uf maybe?

I also tried averaging multiple readings if they were within a certain high/low limit of the first reading. if they were above the limit I would output that value until they were close again and repeat…something like that, it’s been a while since I touched that code and I think it had a lot of room for improvement. I think it worked for the most part though  :smiley:

 

thanx voodoobot. So if the

thanx voodoobot.

 

So if the value is within the limits, take the average; if > upper limit, output that value? what do you mean by output that value?

 

For example, the reading to the wall is 200, and the reading to the object is 220. I need to be sure that the difference in reading (20) is due to the object, and not to noise. I’ve tried the averaging method but the result is still not reliable, especially when the reading is high (> 400).

 

I’ve 2 sensors mounted, can i use some form of triangulation to lock down the object?

triangulation

In order to “see” if triangulation is the way to go, your diagram needs to be more specific. It’s not to scale, I imagine. What is the (typical) size of the object? Does it vary?. What is the typical distance to the wall. Etcetera.

From my

From my collection:

https://www.robotshop.com/letsmakerobots/node/316

and

https://www.robotshop.com/letsmakerobots/node/2959

:slight_smile:

more details

the object is a ball of ~ 7 cm in diameter. the distance between the ball and the wall will vary (depends on how the ball roll there). the robot is equipped with the 2 sensors, placed ~ 15 cm apart. ideally, it’ll move and sense at the same time.

As the sensors readings follow a curve, when the ball is very near the ball and the robot is very near the ball, the readings received from the ball and the wall are about the same, heavily influenced by noise.

I’m thinking of using some form of triangulation method, maybe using readings taken at 2 positions to confirm that the ball is there.

 

Thanx frits

tatz what i needed, some form of visualization.

Unfortunately, this is part of my school project, and I’m stuck with a “not so friendly” controller. there’s a 17 ms reset and we can’t really use the for-loop.

the robot is supposed to sense on the move, hopefully i can adopt the codes for that.

thanx and update soon.

 

2 sensors ?

If your using 2 sensors aimed at the same object, won’t they interfere with each other ? Each is sending out IR pulses and “sensing” the reflection.

I’ll have to collect those

I’ll have to collect those topics…