Let's Make Robots!

recognizing moving objects vs stationary objects

I just finished building the start here robot.  It works great and I'm really excited to have built my very first robot.  Now what I would like to do is try and have it recognize moving objects vs stationary objects and react differently to objects that move.  What I was thinking is that since the robot is stationary when it looks around I would make it look around one more time.  If it looks at an object on the first pass and that object is at position A and then on the second pass the object is still at position A then it is stationary and the robot would behave as it always had.  If on the other hand on the first pass the object is at position A and then on the second pass it is at new position B then it must have moved.  This would be useful because I could then have the robot turn and follow the moving object.  My robot coding experience only involves copying and pasting but if this is possible I think I could figure it out.  I don't want code written for me (that'd ruin all the fun) but I'd like to know if this logic would work or if there would be a better way to accomplish this goal using programming only.  Later I'll upgrade my robot with more parts but for now I just want to play with the programming.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ezekiel181's picture

A simple and fun place to start is object detection. An easy way is to pan your sensor around and compare the new distance to the last distance. If the difference is great then you have just found an edge. Once you know the position of 1 edge just look for the 2nd edge and in between them is an object.

With only 1 sensor your robot twitches around a lot bouncing in between the objects two edges. Mintvelt created an object tracking head using 2 sensors as eyes which are able to be controlled independantly of the head which gives it a much smoother appearance. A quick site search should bring it up.

bobonthenet's picture
I'm not really looking for something too complicated.  I simply want to experiment on the programming with my existing unmodified starter robot and not have to buy any new parts right away.  If I wanted real useful motion tracking I would probably instead buy a camera a computer and find or program some visual software with shape and color recognition and use that for motion tracking.  This will be an attempt to do something that is small and allows me to play around with the programming.  Succeed or fail I hope to learn a great deal.
ignoblegnome's picture

I'm not much of a programmer either, but think about this from the robot's perspective. In order to "follow an object" your robot would have to detect and classify something as an object. That's actually pretty hard. What is easier is to scan once and store the result, then scan again and compare that result to the original. If something has changed, it could mean an object has moved closer. On the other hand, it could mean someone closed a door that used to be open. Or someone has picked up the robot and moved it.

Fritzl has some good thoughts posted on "teaching" your robot rather than "programming" it. It is a good philosophy, especially with the sort of low end processors many of the bots on this site are using.

Teach your robot one step at a time to do the task you want done. Good luck!

bobonthenet's picture
Cool what you said is exactly what I had in mind to try.  I don't know programming but I'm pretty sure I'm clever enough to figure it out within a couple hours.  Is this the device you are talking about? http://letsmakerobots.com/node/11293  That thing looks pretty awesome and for $5 I'm likely to get one soon.  I'd like to just pour money into my new hobby right away but I really should hold off until after the holidays.
jklug80's picture
just keep in mind the moving object would have to be in the foreground. Most sensors only detect what is closest.
jklug80's picture
Detecting if an object moved is easy. Compare the current sonar reading to the last and see if it changed by a big number (it will never be exactly equal). Detecting an object as it is moving is pretty hard given the cheap sensors we all know and love. Check out OddBots IR device he made and is selling through DAGU. He got it to do some motion tracking.