Society of Robots - Robot Forum

Software => Software => Topic started by: airman00 on November 22, 2007, 09:26:23 AM

Title: Scanning Sonar
Post by: airman00 on November 22, 2007, 09:26:23 AM
I'm having a little trouble with making sonar track an object

I am using a PIC 16F616 with PICBASIC

I just need a little help with the pseudo code

This is what I was thinking of doing

Code: [Select]
Scan back and forth
IF object is detected THEN scan right until object is not detected
scan back to the angle where object was detected before
See if the object is still there
IF it is there THEN scan left until object is not detected
IF it isn't there THEN make a complete scan looking for an object
Make a loop


How would you guys go about having a scanning sonar sensor track an object ( pseudo code only, not BASIC or C )

Thanks,
Eric

Title: Re: Scanning Sonar
Post by: paulstreats on November 23, 2007, 10:58:49 AM
i think that because sonar or ultrasonic is not that accurate because of the wide angle thing, you might want to do some extra work in program.

such as

if object not detected scan right until object detected else go all the way back left and scan right again

if object detected record angle eg. 90 degrees continue scanning right until object disappears record angle such as 140 degrees.

find the centre of the two recorded degrees and scan to that location (115 degrees) should be the center of the object unless it or you has moved.

while object is "in focus" repeatedly scan left until it disappears, then right until it disappears to find the central location and keep it in focus.

if its for a robot you could give something else to do rather than just chase things; like drive up until bump sensors are activated then use colour sensor to try and probe as much data about the object as you can.

Also if its t chase something, dont forget that if a wall is detected the robot will 'chase' the wall and bump into it such is the same with all static objects so if it detects a wall it will chase into the wall but will only ever detect the wall and not mve onto anything else.

try and get it to only chase moving objects if you can then it has something to follow and chase.

the easy way to do this is a get out clause such as recording the central angle into an array, if the central angle remains the same for a preset number of steps, ignore the object because it is static and look for something else to get.
Title: Re: Scanning Sonar
Post by: Admin on November 24, 2007, 11:01:26 PM
What do you mean by track? How fast is the object moving?

Another way would be to do a full sweep scan (maybe 5 readings, taking about 3 seconds) - a rough search mode

After that, select the lowest value (closest reading), and then do a higher resolution scan just near that lowest value to improve accuracy. - accuracy mode

loop

If you compare previous accuracy mode angles with the newer ones, your robot can predict target velocity and hence future location of that target.