Let's Make Robots!

My First Robot

bjro's picture
Move and Obstacle avoidance
AttachmentSize
bjrobot.pde6.16 KB

So, I have been kind of dabbling with this thing for maybe 6 months (idea to conception) and well I don’t know what I’m doing wrong but it just doesn’t work the way I had expected it to. Maybe it has something to do with the IR sensor but it seems like it will avoid different colors of flooring in my office. Well in doing so it will end up completely ignoring walls and such and well not avoid them as planned. I have tried to make it as modular as possible. It’s still a work in progress. If you guys have any suggestions I would love to hear them.

Comment viewing options

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

}else if (range > 400 && range <= 500){
    gotime = 1200;
  }else if (range >= 500){ //its too close need to back up and restart
    Serial.println("TheDistance");
    Backward(gotime);
    softReset();

 

if range = 500 you have the same evaulation in 2 spots, not saying thats the problem it just looked weard

bjro's picture

good catch... "else if (range >= 500)" now reads "else if (range > 500)"

bluesthue's picture

I would guess if you have a downward facing ir sensor for edge detection it is picking up the changeover from a lighter surface to black.  My little bot won't drive onto my area rug because he doesn;'t like the black border, but  it will drive fine on a fully black surface.  IF you are using more than one ir (one for wall detection and one for edge detection) it might help to look at what order you're reading them in your code to see if you are just giving priority to the edge detection instead of the obstacle sensor.  Good luck.

bjro's picture

I actually only have the one IR sensor

Chowmix12's picture

debugging the values of the IR sensor over USB to find out what values you are getting.