UPDATE: Mintvelt has made a remarkable new invention in this field, you want to check that out after reading the below!
If you want 2 robots to detect and find each other:
2 Robots tracking is a completely different ballgame than the topic below, in this posting.. Or a robot following something that omits a signal.. These things are quite easy.
Buy a kit and get going: http://www.pololu.com/catalog/product/701
- or DIY: http://www.wichitabuggywhip.com/robots/ir.html
Often it could be nice to have your robot lock on an object, or a person.
And sometimes it is seen done - but how? The cheap IR & Ultra Sound sensors that are common when writing this can only detect distance in front of it.
Trick is, to put it short;Put the sensor on something that can turn (like a servo), and focus on the edge / start / end edge of the object - not the object itself.
Your code can detect when there is a sudden drop - and there is the edge.
If you then focus on 2 sides while scanning, you can determine the middle of the object.
By going for the edge or perhaps middle, you can have your robot follow another, look at your finger when moving it in front etc..
But you should know; This is a very unsteady technology. If a scan just misses once, all can be lost, if it is driving off etc. This happens specially if the object is moving fast / is close or far away etc.
Also be aware that some sensors have a very broad and wide detection area in front of them (such as the SRF05) - this makes it harder to this kind of tracking. Sort of like feeling around with a numb finger :)
More narrow sensors makes it easier - this could bea reason for buying something more expansive than the SRF05 - something with a more pencil-shaped detection area - like the SRF325 LinkI LinkII
Here is a link to a nice tutorial, with some very good tracking on a video. You should not expect to get your robot better tracking than this!
If you really want your robot to lock, and do a good job, you should either start investing in cameras etc, or if it is locking on a person, this might have your interest. I have not tried any of these methods.
If you start thinking on PIR's this is the place.