Software
Instructions
First, you need to understand Java, and read over the provided API.
The following Java references may be helpful for Java beginners:
Setting up Java
You will find your team directory at /mit/6.270/Teams/##,
where ## is your team number. This is where we suggest you
do all of your code development.
Make sure that you are using Java version 1.1.6, or Java version
1.1.7. The board may not work with other versions. On athena, use:
athena% add -f java_v1.1.6
athena% setenv CLASSPATH .
This adds the correct version of Java, and makes the 6.270 classes
visible.
For computers running Windows, go to http://java.sun.com/products/jdk/1.1/download-jdk-windows.html
to download the Windows version of the JDK.
Setting up Botkit
Next, you need to obtain the supporting classes. You can get classes6270.jar here on the web if
you're running java on your own machine. You'll then need to figure
out how to un-jar it on your platform. Please send any questions to
6.270-tech@mit.edu and we'll help you as best we can.
If you're on Athena, simply enter:
athena% cd /mit/6.270/Teams/##
athena% jar -xvf /mit/6.270/dist/classes6270.jar
This will create two directories of library files: botkit/ and java6270/.
Important: You should not do anything to these directories.
Note that if there is a java6270 patch out, you'll want to then do
the same thing as above, but with java6270-1.xx.jar (where xx
is the version number) instead. See the software releases page for details.
Next, you need to create
a directory to store your code. It must be called usercode.
athena% mkdir usercode
Make sure to put all your files in the usercode package, placing
the following at the top of all your java files:
package usercode;
The board will look for a class called Main, so create a
Main.java and put your public static void main(String args[])
method in there.
Please look at the example team directory at
/mit/6.270/www/contestants/distribution/samplecode
If you want to base your robot's code off of this, just modify
the Robot.java file.
The source code to the java6270 package is public, but you should not edit it in place. Rather, if you wish to modify a class, copy it to your own usercode directory first, (modifying the package to usercode,) and then edit your own version from there.
Compiling your code
To compile your code, from your Team directory type:
athena% javac usercode/*.java
To test your code, from your Team directory type:
athena% java botkit.Main
Making a .jar file
Before you can upload your code, you must package it into a .jar file.
This is accomplished by issuing the following command from your team directory.
athena% jar -cvf usercode.jar usercode/*.class java6270/*.class
You may leave out the java6270 part if you do not use any classes in that
package.
Note that you do not include botkit in your jar file, as the botkit
package is already loaded in the kernel. (In fact, the botkit you use contains
VirtualBot and is different from the one in the kernel, which runs the board.)
Communicating with your robot
If you are on an Athena machine (i.e. in the 5th floor / 6.001 lab)
athena% add 6.270
If you are using an HPUX (i.e. in the 6th floor / 6.111 lab)
pal% attach -p 6.270
pal% cd /mit/6.270/bin
Attach your board to a computer with its RJ10 - DB9 connector.
(i.e. serial cable). Type:
minicom
If you are using your own Linux machine, you may need to change the
port to /dev/cua0. If you have questions about how to do this, please
email 6.270-tech@mit.edu.
If you are on a Windows machine, fire up HyperTerminal and use the
following settings: 38400, 8, N, 1, No flow control.
After minicom starts up, turn on your power. You should see a row
of 5 asterisks (*****) in minicom, and the top row of your LCD should
show up as a blocks. If either of these things does not happen,
something is wrong.
For more information on communicating with the RoboSkiff, look at the
Communications FAQ.
Uploading your code
At this point, hit the spacebar. This will abort the boot process and
drop you into the bootloader. (If the board has started really booting, merely
reset it and try again.)
You should see a boot> prompt. Enter:
boot> load usercode
Now hit Ctrl-A, S then select "xmodem" and find your
usercode.jar file.
Notice that the loading code times out very quickly, so if you take too long
to select your file, you'll have to try again.
Uploading a new kernel
Occassionally, we will release a new version of the API, which will require
you to upload a new kernel. The process is identical to the process for
uploading your code, except you type:
boot> load kernel
When we release a new kernel, this section will tell you where to find
the file.
Running your robot
Simply boot your robot and don't hit the spacebar. It'll boot straight into
running your code! If you're already at the boot> prompt, you can
just type:
boot> boot
To quit minicom, enter Ctrl-A, Q.
Have fun!
Any questions or comments should go to 6.270-tech@mit.edu