foureyes.bas (1932Bytes)
I was looking for a way to have a robots head follow something or someone around. The best results I found were the ones using a camera, but these are a bit expensive to my taste. I've seen some robots that have a servo with an IR-sensor on top that finds either the left or the right edge of anything you put in front of it. I toyed around with that, but I got frustrated with a few things.
If you follow the left edge of an object, the robot allways seem to look slightly left past the object instead of in the middle. Also:When the edge is detected, the servo goes from left to right and back between detecting the object and looking past it.
So I came up with the idea to have two IR sensors inside the head that can move (rotate) by themselves: independant of the head. The sensors detect the edges and provide information as to whether to turn the head left or right. The head doesn't need to move back and forth as much to detect the edges, giving it a much smoother object tracker.
I wanted to do this with a picaxe 08M to make "smart eyes". The bots mainboard can than communicate with the 08M to obtain more info than just the range from the eyes. but of course I had to try it out first. Also: with the 08M hooked up to 2 servos and 2 analog sensors that leaves only 1 input pin and no outputs. Oh well.
This test setup was done "the Frits! way": i.e. with paintsticks and double sided tape and a few paperclips.
The top servo pushes the eyes outward and pulls them inward. The bottom servo rotates the "head".
The algorithm is simple.
- Pull the eyes inwards and turn the head in the direction of the eye that detects an object.
- If both eyes see an object start pushing outward
- Turn the head in the direction of the eye that detects an edge (=no object in sight)
- If both eyes lost sight of the object, go back to pulling inward.
The servos are a bit jerky, but the same servos work fine in Edward, so it is probably due to lack of caps or underpowering of the servos.
As you can see in the video (sorry for the poor quality) the eyes are moving back and forth, but the head is steady.
Future improvements
- Make it smaller!
- Put the eyes inside a head so you wont see them moving so much.
- Expand the program to determine object width or width of a possible escape route for the bot
- Put everything in a small independent package. I want this to become an "intelligent" sensor you can just hook up to a bot using serial or I2C or something.
- Add vertical axis