In this document:
The software has been tested on Linux and Windows 9x machines. We expect it to work on all of these platforms:
setenv CLASSPATH /home/you/tb:. setenv CLASSPATH ${CLASSPATH}:/home/you/tb/lib/collections.jar setenv CLASSPATH ${CLASSPATH}:/home/you/tb/lib/Serialio/Serialio.jar setenv CLASSPATH ${CLASSPATH}:/home/you/tb/lib/Serialio/jspComm.jarBe sure the include the ".", it is important.
Other shells and/or operating systems use similar commands to set the CLASSPATH. In Windows you can set the CLASSPATH by editing your C:\AUTOEXEC.BAT file as follows:
set CLASSPATH=C:\tb;.;C:\tb\lib\collections.jar;C:\tb\lib\Serialio\Serialio.jar;\tb\lib\Serialio\jspComm.jarIf you are using a JVM other than Sun's you may need to use some other mechanism to tell it about your CLASSPATH.
To start experimenting with JCye, edit one of the programs; JCyePWM.java is a good start. All user-level commands are implemented by the JCyeSrv class, that is your interface to control of the robot. Look for the code at the begining that establishes a connection to the robot:
/*--- initiate connection to robot ---*/ JCyeSrv Srv = new JCyeSrv( "COM1", // the device to communicate with 19200, // baud rate (9600 or 19200) JCyeComm.NEW_RADIO, // connection is WIRED, NEW_RADIO or OLD_RADIO JCyeComm.BLACK_ROBOT); // robot ID, depends on colorThe example above would be typical for a Windows configuration with a recently purchased robot.
You need to edit this call to reflect the configuration of your robot and computer. The first argument is the name of the serial line device your robot is plugged into on your computer. /dev/ttyS0 or /dev/ttyS1 is typical for a Linux box. COM1 or COM2 (no colon) would be standard on a Windows machine.
The second argument sets the baud rate for communication. All Cyes now being sold (on or after December 1999) use 19200.
The third argument depends on whether your Cye is wired directly to your computer (unusual) or if it uses a radio connection (standard). Use JCyeComm.WIRED, JCyeComm.NEW_RADIO or JCyeComm.OLD_RADIO as appropriate. For RADIO connections several pauses are inserted into the transmitt and receive procedures to ensure the radios have time to warm up.
Finally you need to set the ID for your robot. This depends on the color of your robot, as follows: JCyeComm.ORIGINAL_ROBOT (for older robots using 9600 baud radios), JCyeComm.BLACK_ROBOT (for newer black robots), JCyeComm.ORANGE_ROBOT (for newer orange robots), JCyeComm.YELLOW_ROBOT (for newer yellow robots), or JCyeComm.CHROME_ROBOT (for newer chrome robots).
You are now ready to compile and test the program:
javac JCyePWM.java java JCyePWM 100 100If everything worked, your robot should beep and start moving slowly. You should also see text like this:
java JCyePWM 100 100 Serialio.SerialPortLocal: version 6.6b Copyright (c) 1996,1999 Solutions Consulting, All Rights Reserved. SerialPort class loaded: jspLux86 Last X: 483.94221541452254 Last Y: -37.45327560447702 Last H: 5.459871370376744 Last B: 11.54224 Last X: 484.59785262422895 Last Y: -38.1089128141834 Last H: 5.45445483131883 Last B: 11.58062 Last X: 484.76176192665554 Last Y: -38.354776767823296 Last H: 5.45445483131883 Last B: 11.59981X and Y are the current location of the robot, H is the heading and B is the battery voltage. Take a look at the other example programs in the JCye directory, and the cye package documentation. Pay particular attention to the JCyeSrv class. Enjoy. What's on the horizon
Can't find class forageor something similar when you try to run the demos, your CLASSPATH probably does not include "." Try Step 5 of the installation again.
java.lang.NoClassDefFoundError: TBSim/SimulationCanvas at TBSim.TBSim.Your CLASSPATH may not point properly to the /home/you/java directory. Try Step 5 of the installation again.(TBSim.java:79) at TBSim.TBSim.main(TBSim.java:199)
error: zipfile probably corruptwhile trying to unzip the distribution, you probably either got a bad copy while downloading, or your version of unzip is too old. Unzip v5.12 works properly while v5.1 has been known to complain, but still unpack the distribution. The distribution was compressed with Zip v2.1, please let me know if you have this problem.
Can't find class TBSim.TBSimthen your CLASSPATH probably doesn't point properly to the /home/you/java directory. Try Step 5 of the installation again.
java.lang.NoClassDefFoundError: TBSim/SimulationCanvas at TBSim.TBSim.Your CLASSPATH may not point properly to the /home/you/java directory. Try Step 5 of the installation again.(TBSim.java:79) at TBSim.TBSim.main(TBSim.java:199)
This might also be caused by a corrupted download or unzip operation. Try getting a new copy of the distribution from the webpage or just unzipping again. You may have unzipped with the "-a" option, try it without.
Unable to initialize threads: cannot find class java/lang/Threadthen you are probably running Java 1.0.2 instead of Java 1.1.
./demo: java: not foundmake sure java is in your PATH somewhere, and that Java 1.1 is installed on your system.
java TBSim robocup.dsc 511 300