At the forefront of Artificial Intelligence
  Home Articles Reviews Interviews JDK Glossary Features Discussion Search
Home » Articles » Robotics » Norland Research Calculator Robot

Introduction to the Calculator Robot

The Calculator Robot is fun once you get used to the TI-BASIC side of things. This article should hopefully get you acquainted with the basics of writing a program. This program is a little more complicated (in some ways it is simpler) than the example Norland Research provide: this program will make the robot reacte according to which side the bumper is hit on. It will also display a "radar" on its screen as it roams about. You can download the program and picture files here:

The Code

We will step through the code bit-by-bit:
0->S
191->I
135->F
64->G
132->R
Here what we do is set up a few variable names with pre-defined meanings. For example, we assign the number that makes the robot stop to S, the number that makes the robot move forward to F etc. See the manual for details about the other numbers.

Lbl A
ClrDraw
RecallPic 1
F:Asm(prgmSRBTEST)
G:Asm(prgmSRBTEST)
The "Lbl" simply marks a label in the program that can be jumped to using the "Goto" command. The next statements clear the screen and recalls Pic1. Pic1 is a picture of the radar screen (above). Now we set the robot to move forward, but remember you must set the type of movement then tell the robot to execute the move command. F is set to forward, and G to go. The Asm(prgmSRBTEST) calls the program that interfaces with the robot hardware.
7
While Ans>6
getKey->K
I:Asm(prgmSRBTEST)
If Ans=4:Goto F
If Ans=5:Goto L
If Ans=6:Goto R
If K=45:Goto X
End
The "7" confuses a lot of people - basically, when you execute anything, the result of the calculation is stored in Ans (the answer variable). So, that 7 effectively puts 7 into Ans, which allows the While statement to run. The while statement simply reads from the inputs and tests whether both switches were triggered, the left switch was triggered, the right switch was triggered or whether the user hit the Clear button to exit.

Lbl F
ClrDraw
RecallPic 4
S->X
Goto Z


Lbl L
ClrDraw
RecallPic 2
134->X
Goto Z


Lbl R
ClrDraw
RecallPic 3
133->X
These three "routines" load the correct picture up for the radar (see screenshots), then load a value into X that corresponds with the action the robot should take. If the robot bumps into something full on, we want to stop, so load S (Stop) into X. If the robot hits something on its left, make a full left turn (134). If the roobt hits something on its right, make a full right turn (133). After we have loaded the action to do into X we jump to Z.
Lbl Z
S:Asm(prgmSRBTEST)
R:Asm(prgmSRBTEST)
G:Asm(prgmSRBTEST)
For(Y,1,15):End
X:Asm(prgmSRBTEST)
G:Asm(prgmSRBTEST)
S:Asm(prgmSRBTEST)
If X!=S:Goto A
Here we stop the robot, reverse for a little while. Then we run out X command, stop and (if the command wasn't to stop) start running again.
Lbl X
S:Asm(prgmSRBTEST)
ClrDraw
Stop the robot, and get rid of the radar screen!

Submitted: 04/11/2000

Article content copyright © James Matthews, 2000.
 Article Toolbar
Print
BibTeX entry

Search

Latest News
- Generation5 10-year Anniversary (03/09/2008)
- New Generation5 Design! (09/04/2007)
- Happy New Year 2007 (02/01/2007)
- Where has Generation5 Gone?! (04/11/2005)
- NeuroEvolving Robotic Operatives (NERO) (25/06/2005)

What's New?
- Back-propagation using the Generation5 JDK (07/04/2008)
- Hough Transforms (02/01/2008)
- Kohonen-based Image Analysis using the Generation5 JDK (11/12/2007)
- Modelling Bacterium using the JDK (19/03/2007)
- Modelling Bacterium using the JDK (19/03/2007)


All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -