Society of Robots - Robot Forum

General Misc => Robot Videos => Topic started by: quickflame on October 15, 2009, 07:15:24 PM

Title: object avoidance photovore
Post by: quickflame on October 15, 2009, 07:15:24 PM
is it possible to add an ability to a photovore/light follower robot to have an ability to avoid objects?
and how woud this be attained???  has anyone did this before? any help woud be appreciated (ideas,schematic diagrams, programming) thanks!
Title: Re: object avoidance photovore
Post by: parallax on October 16, 2009, 09:47:56 AM
If you give the range-finding sensor priority over your photoresistors in the code you'll be all set. This can be achieved with an if-else statement in the main loop of your program. Here's some example psuedo-code:

Do-While(){
if (object is to close){
    avoidance_behavior();
    exit();
    }else{
    Lightseeking/fleeing_behavior();
    }
Other code here
}
End_Do-While

If the first condition is true then the robot will skip the light seeking (or fleeing depending if your building a photovore or a photophobe) and go into whatever avoidance routine you program. Otherwise it will continue to love or hate the light.  ;)

Hope that helps!