[...]... reviewing the basics of communication, and then discuss how to get the robot to move, hear, see, and navigate, before exploring how to optimize code and create shortcuts I’ve divided each chapter into subtopics that progress from easy to difficult Each subtopic includes the following: • An introduction to the topic • A detailed discussion of the code example • A code example demonstrating the topic •... empty constructor where I initialize the enumeration of the ports This will be the list of all ports identified by the driver The second method in the class is the list() method The first line in the method is a while loop that iterates through the enumeration of ports Upon getting the next element from the enumeration, it receives the portType (serial or parallel), and then prints the name of the port... here’s the definition of those terms: • Events: These are the things that cause a robot to do something Does it hear a word, see something, or get a request from the network, or is there a scheduled task, or something like that • Tasks: These are the things that events trigger So if the robot gets a request to move someplace, the top level task would be to move The move task would then have to call... caused by some action The simple state machine shown in Figure 1-7 shows how they are typically drawn Starting at the top circle (called the initial state) the pen tip is retracted Click the top of the pen and it’s at a new state, extended and ready to write, which is now represented by the bottom circle Click it again, and you’re at your original state Pretty simple, huh? 9 Preston_ 5564C01.fm Page 10... your robot to do, how you want your robot to do it, and most importantly: when you want your robot to do it Finally, in order for your program to transition properly, when it’s ready you’ll need to be able to “pause” your program to allow these new states to materialize To pause your program with Java, use the following four ways defined in Table 1-3 97022d2480fe4a63cfdfa123a6e70098 Preston_ 5564C01.fm... need to stay alive about two hours before recharging If this is the case, your options are limited If the terrain changes to desert or the budget increases to $2,000, your list of possible technical solutions will change drastically However, just having a drive system is not going to allow you to solve the main objective of getting a robot to navigate to the fridge To do that, the robot will have to. .. that might not be obvious to a beginner (see Table 1-2 ) Table 1-2 Important Java Concepts Concept Description Constructors A constructor is a method in a Java class that defines how it’s instantiated Keep a close eye on how you want your objects to be created If you’re too flexible, you could run into timing or other exceptions If you’re too rigid, your class will be too hard to use Exceptions Errors... Serial Port Again, configure the serial port to the following: 9600 baud, eight data bits, no parity, one stop bit, and no flow control To configure this for Windows, open the Control Panel, choose System ➤ Hardware ➤ Device Manager, and then click Ports Make sure to note the (COMx) port number You can see the windows for these in Figures 2-1 and 2-2 shown next ■Note UNIX users, the ports here are numbered... references to COMx with ttySx 15 Preston_ 5564C02.fm Page 16 Wednesday, September 14, 2005 5:42 AM 16 CHAPTER 2 ■ SERIAL COMMUNICATION Figure 2-1 The Device Manager window Figure 2-2 The Communications Port Properties window Preston_ 5564C02.fm Page 17 Wednesday, September 14, 2005 5:42 AM CHAPTER 2 ■ SERIAL COMMUNICATION The Java Communications API I will use the following classes from the Java Communications... will have to perceive Perception To illustrate what the world of robot perception is, I’m going to ask you to do a few experiments You’ll really have to do these experiments to fully understand the problem To start with, go to your living room and shut your eyes Hold your hands in front of you and try to make it to the kitchen so that you are in front of your refrigerator If /when you hit something, . The Definitive Guide to Building Java Robots ■■■ Scott Preston Preston_5564Front.fm Page i Friday, October 7, 2005 5:14 AM The Definitive Guide to Building Java Robots Copyright © 2006 by Scott. Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-8 00-SPRINGER, fax 20 1-3 4 8-4 505, e-mail. 403 Preston_ 5564Front.fm Page vii Friday, October 7, 2005 5:14 AM 97022d2480fe4a63cfdfa123a6e70098 Preston_ 5564Front.fm Page viii Friday, October 7, 2005 5:14 AM ix About the Author SCOTT PRESTON