Page 240 - The Ultimate Palm Robot
P. 240
Color profile: Generic CMYK printer profile
Composite Default screen
Bots /The Ultimate Palm Robot/ Mukhar & Johnson / 222880-6 / Chapter 8
Chapter 8 Taking Control of the BrainStem Robot 223
The new reflex vector calls the mTIM1 command message in the program.
Recall that this sets the timer for two seconds and then executes the reflex vector
aGP_RFX_TIMER_1. After compiling and loading the new to_fro.bag program
to the BrainStem, you would use the following two commands to cause the
BrainStem to execute reflex aGP_RFX_BOOT the next time the BrainStem is
started:
2 18 6 1
2 19
The parameter 6 is the system variable that controls whether the BrainStem
issues reflex aGP_RFX_BOOT at startup. The second parameter instructs the
BrainStem to issue the reflex. Instructing the BrainStem to not issue the reflex
is done by setting the second parameter to 0, as shown here:
2 18 6 0
2 19
Programming the BrainStem Using Java
One of the most popular new languages in recent years is the Java program-
ming language and environment from Sun Corporation. Java originated in the
mid-1990s as an embedded language for consumer electronic devices. The pro-
ject was never fully realized and Java became a solution in search of a problem.
Coincidentally, the mid-90s was also the time when the World Wide Web began
to explode. The features of Java made it an ideal language for programming
web applications. While it was first used as a language for programs that ran in
a web browser, Java is also ideal for mobile devices (like Palms). Java running
on mobile devices is known as Java 2 Micro Edition, or J2ME.
However, there’s a slight problem. Java is able to run on many different
platforms because the platform-specific code is contained in the virtual ma-
chine or in special Java libraries. Host computers communicate with the
BrainStem using the host’s serial port, and that requires platform-specific
code. Sun’s Java virtual machine does not come with Palm-specific code for
communicating through the serial port. So, even though you can run Java pro-
grams on a Palm OS device, you can’t use Sun’s Java virtual machine for the
Palm to control the Palm. If you want to use a Java virtual machine to control
the robot, you’ll need to run your code on a PC.
P:\010Comp\Bots\880-6\ch08.vp
Monday, May 12, 2003 1:16:47 PM