Let's Make Robots!

IR SENSOR ROBOT

Avoiding objects and walls
AttachmentSize
base_ir_robot_meucod.pde1.54 KB

This is my second robot, it is the same basic "cutting board" robot but now using the Sharp GP2Y0A02YK0F to avoid objects and walls. The code have comments and functions in portuguese like frente() = forward(),  it was the way i found to undestand how to do it and to help other people from my country to understand it too. I think it is very basic code and if you have some advice to improve it .. it is welcome!

After testing i found that the values readed by the sensor have the following relation:

600 = 20 cm
500 = 35 cm
400 = 45 cm

So... changing that values in the code changes the distance that the robot stop when it detects an objetc.
That sensor have a good range , about 1.5 meter but that is not usable because the readings get very unstable.

The logic in the code makes the robot go ahead > stop when object is detected > turn head left >  scan >  if clear > turn left. If there is and obstacle in the left it scans to the rigth and if clear turns rigth. If there is obstacle in front, left and rigth it turns rigth again to try scape the trap. It always go back a little to make easy turning around.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
I like it !!!
Looks great. I like the chopping board :)

Hello, I am making a robot, the programming and the circuit is pretty similar to your robot, my problem is that for some reason I am unable to stop the servo motors, sensors are working correclty, any recommendation? thank you.

Please use the link below to see my code for this robot, maybe it can help:

https://docs.google.com/leaf?id=0B4nH-dLKWTKmMDI5NWJlOWItMWYxYy00YjNjLWFkNDctNWEyYmMwYzJhZDlj&hl=pt_BR

Good Luck!

First saw the video and was thinking "man, that's a chopping board, what the hell is he doing with this?"

Well done, especially the chassis ;-)

I especially like your application of a landing strut as a sensor tower.  Cooool.

Yes! it is a landing gear from an old model plane.... you are very good observer!