How to build your first robot - Part II - navigation
| Attachment | Size |
|---|---|
| clean_navigation.BAS | 6.17 KB |
This is Part II of How to build your first robot - tutorial.
you can just take the cool navigation-code in here and have fun with it, or you can follow the whole instruction, or the parts that you like. I try to make it as general and open as possible.
Here is part III of this tutorial - I recomend that you browse this as well!
Progress:
You have made a robot, something like this: How to build your first robot
You have read my deep thoughts on how to move on with the programming "Don't program your robot.. Teach it!", and you have made tricks with your robot, messed around with it, had some fun and is ready to move on.
Perhaps you have tried out this little trick of seeing what your robot sees.
You have seen on the video of "Making Skiwalker", and seen on the pictures of "Yellow Drum Machine" (the pics in the bottom) - that you do not need much for materials to make a robot; Melt-glue, double sided tape, sticks, and you are go!
If so, this part II should be a breeze! You can make this robot in 45 minutes, no sweat.
First, let's make the robot on the picture above. Try to duplicate the main parts, that is the main task here.
It shuld not need much explantion, it is excaxtly like the one from How to build your first robot - only differences:
- Instead of Sharp sensor, I use SRF05
- The servo is a smaller one, and a fast one - you can get these in any size and speed
- The gearing on the motors is lower, so I have a faster robot (though it is not a speed-king, lol)
- instead of just taping it all together, I have used 3 sticks to form some sort of a "chassis"
The closer you get to this, the easier it will be to follow the rest, but of course you can just do it your way, with whatever parts you have etc.
In the first tutorial I wrote that you could make some fancy code for the robot.
I now present you for some code that I have made, it is what is used on the video. It is an example, there are thousands and millions of ways to evolve, you should do it your way. This is just to try to open your eyes, and share what I have learned after countless hours of trial and error.
Try to alter some of the numbers to tune in to your setup, and read the guidelines in the code. That way you can get a robot like the one on the video, and we are going to use that as a base for Part III in this tutorial...
Find the attached code in the top of the post.
.. And the screwdriver-trick on the video?
Well.. Look for places where the code says
servo Servopin,head
and add, just after it
servo 1,head
If you are adding another servo on pin 1.
Think about what to attach instead of the screwdriver?
Something with an LED on? And insert some on/off in the code for the LED? Or a fan? or.. :D
Stay tuned. This bot is getting more enhancements now..
And if some of the comments below does not make sense, please understand that I am changing this over time, so the comments may have been for an earlier text here :)
Thanks, and do post what robots you make, to inspire back. Thank you.
/ Fritsl




@ Tue, 2012-01-17 03:14
Where can i get that metal
Where can i get that metal cover for the srf05?
@ Sat, 2011-10-29 16:16
the code
ok i have read the code and have quite a few questions;
what is the mayturn variable i dont see any use for it but it says to add one after every turn and take one when you go to an interesting place the notes at the top say undocumented variable?
after PHASEA1 it just goes back to the rest of the code and never goes onto the rest of the code also when your robot in the video has nothing infront of it it seems to look left and right to dodge things in the code i cant see where it says to do this?
and finally
in Sharp_R: it says If head < ForwardLeft and head => 75 then
head = head + 30
pause 50
servo Servopin,head
but it only goes to Sharp_R: if the head is already pointing completley to the right so that wouldn't happen and any way if you just turned right into a space and saw a space on your left why would you turn right?
this may just seem like i am criticising it but i want to either write my own code or fully understand the code i am using to help me learn to write other programs in the future
thanks alot :)
-
@ Sun, 2011-03-20 23:10
no I mean the code at the
no I mean the code at the top of the page.
@ Sun, 2011-03-20 15:11
for making this robot would
for making this robot would I need to hook the srf05 up here: http://letsmakerobots.com/node/66 and still use the same code or is that the only place you can hook it up any way.
@ Sun, 2011-03-20 18:58
Different hardware = different software
The parts in the code that relate to the sensor will be different, because your sensor hardware is different. Doesn't that node 66 give example code for Picaxe?
In a nutshell: the ultra sound sonars need a pulse to transmit and then measure time until the echo. The SRF has different ways of offering it measurement to you. Time to start reading your manuals!
@ Thu, 2010-12-02 23:48
Great robot and even better
Great robot and even better code. I'm thinking about using this code for my bot
@ Fri, 2010-12-17 14:40
But I am having trouble
But I am having trouble getting the code.
@ Fri, 2010-12-17 14:45
No problem here. :-)
No problem here. :-)
Do you want me to try and send it over PM?
@ Tue, 2010-06-22 12:28
it was a big help
it was a big help
@ Fri, 2010-06-18 05:06
SRF05
I'll building this with my 11yo daughter as our first robot. I've been studying the code for the last week waiting for the parts (kit purchased from Solarbotics, SO helpful). The SRF05 didn't come with a cable. I was thinking of soldering header pins on the board. Would that be good or would you recommend soldering wires directly to the board?
Thanks for the tutorial. We're very excited about getting this going!