View Single Post
  #10   Spotlight this post!  
Unread 06-04-2008, 23:53
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Programming n3wb needs help

You can use an ultrasonic ranging sensor, like the one recommended above, or an infrared proximity sensor (I recommend the Sharp GP line, available from a number of retailers if you google "sharp infrared sensor").

The easiest solution is to put one sensor looking to the left, one sensor looking to the right, and one looking dead ahead. Alternatively, put one sensor looking forward and to the left, and the other forward and to the right (both on 45 degree angles). You could also put a single sensor on a servo and scan back and forth, but this is a bit more complicated.

Now all you have to do is write code to turn right when an obstacle is to the left, turn left when an obstacle is to the right.

If there's an obstacle in front of you, you can turn either way, or reverse (up to you!).

You can make this as simple or as advanced as you want. It could be as easy as what I described, or as hard as making a closed-loop control function to always keep you a certain distance away from the wall.