I’m determined this summer to learn PBasic, i think… Basically on my team we’ve had an engineer from UL do all the programming for the past 3 years, but next year since I will hopefully be on a rookie team down in maryland, i’d like to know how to program a robot.
Basically my question is for all of you programmers is: What do you need to know about programming a robot? What is the “program” called? Where can I learn it (like what books can i read??) and How did you all learn it?
For starters you can read the basic stamp manual. It helps if you already know how to program in another language, though. For a very simple explanation even a ‘non-programmer’ could understand, look at the articles at the FIRST-Codex site.
If you already have some programming expierience in other languages (so that you know the lingo, how programming works, etc.), best way to learn pbasic is to read what the robot controller does first, then pull up the default code from www.innovationfirst.com , and go through it line by line to learn how it works. The manual just contains tons of stuff you don’t need to know and just confuse you and/or waste your time.
*Originally posted by Jim *
**I am not much of a programmer, but it seems like getting a BOE-bot would be a good idea. That allows a lot of controls experimentation, no? **
If by BOE, you’re referring to the Parallax Board of Education that you can get for the Stamp processor, and not the robot prototyping kit from IFI, it’s kind of a mixed bag…while the BOE will help you learn PBasic, writing control code using direct Stamp access to the motors, etc., is a lot different than using the SERIN/SEROUT methods used by the Robot Controller…
You shouldn’t have any problem programming the stamp, I was actually suprised at how simple it is for most robots. Leave messages here or at the codex and I am sure people will answer any question you ask
There’s a reason PBasic is called “PBasic”. Syntax-wise, other than programming the graphic calculator, it’s the easiest thing to program. LIke I said, syntax-wise. (If you don’t know, syntax is the actual typing part of the language. In other words, where the equal signs, multiplication signs, variables, etc… go in the program.)
It is very simple to write basic robot functions in the program.
Now, for those sophisticated robots that rely heavily on the program, such as our robot balancing program from last year:D, there are two things that are limiting about PBasic:
  The number of variable you can use- You are limited to 26 bytes of variables.
  Interarithematics- There are no decimals or negative number in PBasic*
There are other tips and tricks. If you want to know more, you can email me or AOL IM me at Khalicl13. You can also look at the Stamp Manual. It’s extremely useful.
I have to go now. Good Luck.
There is an exception to this: Decimals and negative numbers are possible if you DEBUG (displaying data on a computer from the programming chip) some data.
There’s a reason PBasic is called “PBasic”. Syntax-wise, other than programming the graphic calculator, it’s the easiest thing to program. LIke I said, syntax-wise. (If you don’t know, syntax is the actual typing part of the language. In other words, where the equal signs, multiplication signs, variables, etc… go in the program.)
It is very simple to write basic robot functions in the program.
Now, for those sophisticated robots that rely heavily on the program, such as our robot balancing program from last year:D, there are two things that are limiting about PBasic:
The number of variable you can use- You are limited to 26 bytes of variables.
Integer Arithematics- There are no decimals or negative number in PBasic*
There are ways to get aroung some of these things and there are other tips and tricks. If you want to know more, you can email me or AOL IM me at Khalicl13. You can also look at the Stamp Manual. It’s extremely useful.
I have to go now. Good Luck.
There is an exception to this: Decimals and negative numbers are possible if you DEBUG (displaying data on a computer from the programming chip) some data.
actually, PBASIC can handle negatives, or at least it says it can. it just has nasty habits of screwing them up if you do to much with the negative number. this year i programmed the robot with a few equations that went negative but then came back positive right away.
i learned PBasic this year and it wasn’t that hard. Play around with a Boe-bot some. it mostly helps with knowing how long a loop is. If you can get an old controlor, a window motor, and a servo to practice on it helps alot. I learned ramping for our drive motors and it was realy helpful. Sensors are fun to play with also. E-mail me (or team 930) if you want some help. Have fun;)
*Originally posted by Ian W. *
**actually, PBASIC can handle negatives, or at least it says it can. it just has nasty habits of screwing them up if you do to much with the negative number. this year i programmed the robot with a few equations that went negative but then came back positive right away. **
That’s correct. I did the same thing. PBASIC works with negative numbers EXCEPT when dividing (including modulus) and comparing (including MAX and MIN.) Those are the only exceptions I can think of right now. There may be more though (like probably trigonometric functions).
so, only use negatives when absolutly needed, or if you know it will work (which means don’t put a new equation in that goes negative, and not test it before a round). as for new code, NEVER put in new code right before a round. always test it out first, unless ready for your robot to die on the field.
The way that PBASIC “handles” negatives is by treating them as their standard two’s complement. -1 is treated as approx. 65,000. Therefore, any useful operation will fail because the number is not actually negative. Because the two’s complement system was originally designed to allow “negative” numbers to be added and subtracted using the same CPU instructions as unsigned numbers, these two operations work just fine in PBASIC.
If you need to do negatives for some reason (my team hasn’t had any yet), the easiest thing to do is just pretend that something else is zero. For example, you could think of the number 120 as being -7 and the number 134 as being +7. Then, anytime you use this number, just use a Min/Max statement and then subtract 127 off the end, much like the white paper Innovation First has on “One Joystick Tank Drive.”