Society of Robots - Robot Forum
Software => Software => Topic started by: Cubebot on November 26, 2008, 08:31:09 AM
-
I am new to C, and before my Axon and other parts arrive, I need a code written for me.
I plan to put two IR sensors on each side of the robot, so that it has stereoscopic vision and can therefore make smart decisions about which way to turn, not just to turn. I need a script that does the following:
Start going straight relatively fast
If left or right IR measures less than 6cm in distance, then
See if Left IR value>Right IR Value, if yes turn left (Right servo 50 revolutions, Left servo 25 revolutions, then keep going straight), if no turn right (Left servo 50 revolutions, Right servo 25 revolutions, then keep going straight). I just need the robot to make a slight right or left turn, so you may tweak the number of revolutions to get it right for a very small (3x3x3) robot. Assume that the left IR goes on ADC 1 and the right on ADC 2, and that the left servo goes on E2 and E3 on the I/O.
-
I need a code written for me.
Are you serious?
Write it yourself... Learn it.
-
The last post was a little harsh, but the point is valid. If you want a canned robot, then just go buy one. The whole point of this forum is to assist people who want to learn how to do it themselves. The code you are asking for is pretty simple and much of it is covered in the $50 robot tutorial. You might want to start there and then modify it to do what you want.
This the perfect chance to learn C, so dive in, and most of all, have fun.
-
Stereoscopic vision with distance sensors? That doesn't make sense at all. Stereoscopic vision only applies to vision sensors like cameras, and use the difference in the two images to compute distance.
Also, we are here to provide (free) knowledge. If you have question on how to do something, that we can answer, if you want code written FOR you, hire a programmer.
-
Okay, and by stereoscopic I mean it could see which way it was facing relative to an obstacle and make the shortest turn to get back on its way.
-
All the code is done for you with the Axon, you just need to copy/paste the commands you want to use into control.c:
http://www.societyofrobots.com/axon/axon_function_list.shtml
In fact, it also has default photovore code which is 90% of what you want already :P