New here - Just a few things
AdamE
Posts: 11
Just thought I'd introduce myself and explain my situation for starters;
My names Adam, Ive just been selected to join the robotics team at my school. The main assignment is to program a Boe-Bot to travel through a maze and reach the endpoint within a time limit, the fastest one winning ofcourse.
As far as my programming experience goes, Im only 16 but I've been programming since I was about 9 years old. Im currently using Darkbasic Pro, www.darkbasicpro.com, an excellent version of BASIC.
Ive pretty much mastered the language (I know, there is no mastering a language, but you get what I mean) and can create almost anything my mind thnks up.
Ive just installed the main BASIC Stamp compiler/editor, and Im currently looking over some basic code snippets and methods of doing things. So far the language looks extremely similar to DarkBASIC's language (ofcourse they're both basic so that makes complete sense), so getting used to how things work shouldnt be too hard. My main problem is figuring out how it recievs the information from the Boe-Bot (how to make the Boe-Bot move/turn/stop, and how to obtain the distance to the walls infront, to the left, and to the right of the bot using the infra-red raycasting system). But I've been doing some research and it looks relatively simple, sending a certain charge to Pins will turn them ina certain direction at a certain speed is what I've been able to figure out so far.
Anyways, the due date for this thing is mid-May and I'm (as far as I know) the only programmer on the project. I've figured out all of the artificial intelligence needed to make this thing work and Im also working on creating a virtual simulation of the bot using the AI theories with Darkbasic Pro, just to see if there are any major problems I need to correct.
Im not usually the type to ask for pure code, more like asking for a hint in the right direction, but my deadline is coming in fast and Ive still got to balanace school work and other things. Ill still be constantly researching how this thing works for pretty much the rest of the weekend, (well not Sunday as much as Im going to a wedding), but I was just wondering if anyone had some useful links to other tutorials, common methods for doing the usual tasks a Boe-Bot requires, or other hints.
Hope to be showing some sort of progress soon,
- Adam (jeez there aren't any good emoticons on here are there :P)
My names Adam, Ive just been selected to join the robotics team at my school. The main assignment is to program a Boe-Bot to travel through a maze and reach the endpoint within a time limit, the fastest one winning ofcourse.
As far as my programming experience goes, Im only 16 but I've been programming since I was about 9 years old. Im currently using Darkbasic Pro, www.darkbasicpro.com, an excellent version of BASIC.
Ive pretty much mastered the language (I know, there is no mastering a language, but you get what I mean) and can create almost anything my mind thnks up.
Ive just installed the main BASIC Stamp compiler/editor, and Im currently looking over some basic code snippets and methods of doing things. So far the language looks extremely similar to DarkBASIC's language (ofcourse they're both basic so that makes complete sense), so getting used to how things work shouldnt be too hard. My main problem is figuring out how it recievs the information from the Boe-Bot (how to make the Boe-Bot move/turn/stop, and how to obtain the distance to the walls infront, to the left, and to the right of the bot using the infra-red raycasting system). But I've been doing some research and it looks relatively simple, sending a certain charge to Pins will turn them ina certain direction at a certain speed is what I've been able to figure out so far.
Anyways, the due date for this thing is mid-May and I'm (as far as I know) the only programmer on the project. I've figured out all of the artificial intelligence needed to make this thing work and Im also working on creating a virtual simulation of the bot using the AI theories with Darkbasic Pro, just to see if there are any major problems I need to correct.
Im not usually the type to ask for pure code, more like asking for a hint in the right direction, but my deadline is coming in fast and Ive still got to balanace school work and other things. Ill still be constantly researching how this thing works for pretty much the rest of the weekend, (well not Sunday as much as Im going to a wedding), but I was just wondering if anyone had some useful links to other tutorials, common methods for doing the usual tasks a Boe-Bot requires, or other hints.
Hope to be showing some sort of progress soon,
- Adam (jeez there aren't any good emoticons on here are there :P)
Comments
http://www.parallax.com/dl/docs/books/edu/Roboticsv2_2.pdf
Mike
One of the other Appendixes has information on running mazes of various types.
Mike
Post Edited (MikeK) : 4/23/2006 4:32:23 AM GMT
Im still working on getting the hang of the language but Im pretty confident Ill be able to finish this thing in time for the competition.
The current code:
I can see a few places where it could be made more efficient but Im not worrying too much about that as of right now. I only have a few things left to figure out how to accomplish and then Ill be pretty much set for programming this thing, mainly being;
- Traveling a specific distance (Im looking into how to use the wheel's circumference and speed of travel for this. Though finding the speed the robot is moving at is proving to be a bit daunting.)
- Turning a specific angle (I realize this and the previous point is fairly hard to get precisely, but Im hoping Ill be able to get it close enough that the turn is relatively 90 degrees to the right or left.)
- Non-Programming wise I need to get the measurements of the maze sections in order to figure out the distance I need to move and how big the maze is in comparison with the robot.
Other than that Im pretty much set. I hope nobody sees this as a question (though ideas are welcomed), Im just posting my progress in hopes of it possibly enlightening someone else that comes to the forums for help, as well as trying to establish myself a bit on the boards.
Special thanks to Mike for giving me a point in the right direction for the hardware problem I fixed it in no time. Thanks Mike.
data_ln·CON·3
clk_ln·CON·7
I'm not sure if it's significant (I'm still new to this myself), but in all the code I've seen I/O pins are defined like this:
data_ln·PIN·3
clk_ln·PIN·7
You don't have any RETURNs for your GOSUBs. That will get you into trouble.
In your comments you're using the word "subdirectory" when you mean "subroutine". It won't affect the code, but...
The code in your "move" subroutine is sending data to the same pins as the code in your "sound" subroutine. One of them must be wrong. That's a good reason to use names for your pins instead of numbers.
For making sound you probably want to use FREQOUT instead of PULSOUT.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
I only though returns were necassary for GOTO's, as GOSUBs return to where they were called automatically.
Thanks for the correctio with the subroutine, Ill fix it up tonight.
The GOSUB's do "return to where they're called from", but only do that when they hit the RETURN keyword. There's nothing in the next GOSUB target label that says "RETURN from previous GOSUB when you get to this line".
And GOTO'S have no "RETURN" statement.
What's going on is, when you hit a GOSUB, the 'return address' of the code location after the "GOSUB" keyword in the program is 'pushed' on a 'return stack'. The program then resumes execution at the GOSUB target label.
When the program hits a 'RETURN' statement, the 'return address' is 'popped' off the 'return stack', and is used as the next location to execute. This "GOSUB--RETURN" cycle is critically important to how software works.
Now, a "GOTO" doesn't 'push' a 'return address', it just redirects execution directly to the GOTO target label. If overused, this leads to something called "spagetti-code", where the process flow bounces all over your source. This can be very difficult to debug, or even get correct in the first place.
Oh, and if you DO try to "RETURN" without having done a 'GOSUB' first, then there IS no 'return-address' sitting on the 'return stack'.· The BS2 resets itself in this case.
And then to call it;
Which would make D# equal 15. Is there anything similar to this in Stamp because Im much more comfortable with using functions than subroutines.