Chapter 5: The Central Control Program |
Iris.4 Mobile Robot Manual |
The Environmentalist Activity begins when the camera sends a digital image to the vision system for processing. Within this image, the vision system identifies an empty soda bottle on the Activities Table, then sends an English sentence to ProtoThinker: "There is an empty soda bottle on the Activities Table." PT incorporates this information into its set of beliefs, which are subsequently processed by PT's internal AI engine. According to her environmentalist beliefs, PT deduces that, "I should recycle the empty soda bottle." This sentence is sent to the Text-to-Speeech Engine, which turns this sentence into sound waves and sends them along an analog link to Iris's speakers, which amplify the signal and produce the virtual voice that speaks, "I should recycle the empty soda bottle."
While this is going on, the Mind Module (which reviews all messages) takes the sentence and compares it to a list of sentence-action pairs. The Mind Module finds the sentence and determines that it should run the FINAL RECYCLER script. The Mind Module sends a text message to the Servo Controller Interface telling it to run the FINAL RECYCLER script. The Servo Controller Interface retrieves the FINAL RECYCLER script from its scripts database, and turns the script into a string of 1's and 0's that are sent to the Servo Controller over the USB link between the laptop and the controller. The Servo Controller turns the 1's and 0's into analog signals, which then turn the wheels on and off, and tell the servos in the gripper arm to move to different positions. In this case, Iris drives across the room, stops at the Activities Table, picks up the empty soda bottle, and throws it into the recycling bin.
It should be obvious that a lot of information is moving around the system, including digital images, English sentences, and text commands. Figure 1 outlines the information flow (click for a larger image):
This demanding information flow is accommodated by a flexible piece of software called the Central Control Program, or CCP, for short.
The CCP facilitates communication, and is the glue holding Iris's software system together. The CCP does this by acting as a message-passing system that all of Iris's other software modules use. Iris's software components are CCP-clients: they connect to the CCP over an internet connection and use it to send and receive messages. All messages are passed between CCP-clients via the CCP. For example, if PT wants to tell the TTS program to say, "I ought to throw the empty soda bottle in the recycler," PT will compose a message that includes this sentence and give the message to the CCP. The CCP will process the message and forward it to the TTS program, which can then vocalizes the sentence. You may be wondering why PT doesn't just send the message directly to the TTS program; the explanation underscores the reason for creating the CCP in the first place... For any two programs to communicate, they must have a protocol. A protocol is simply an agreed upon set of rules for communicating. In fact, protocols aren't just for computer programs - you use them all the time! For instance, the de facto protocol for a workplace or school greeting goes something like this:
Of course, most of us speak a bit more casually and use slang, but the general pattern is the same. That is, there exists a set of unwritten rules by which we conduct our greetings. When these rules are formally laid out, they comprise a protocol, which is exactly what the CCP uses to make communicating with other programs easy.
Unfortunately, because there are so many different types of computers (PCs, Apples, Suns, etc.), so many different operating systems (Windows XP, Windows 98, Linux, Solaris, and so on), and so many different programming languages (C++, C, Java, VB, PHP...), it is very difficult to create custom protocols for every pair of programs that need to communicate. For instance, to create the unique protocols for PT to communicate directly with the Text-to-Speech Engine, and to create protocols for all of the other programs to communicate with one another, at least five separate protocols would need to be defined, implemented, tested, and maintained. This is a lot of work! Instead, all programs communicate via an intermediary (the CCP), thus we reduce our workload to the development and maintenance of exactly one main protocol - the CCP Protocol. Because all of Iris's software modules connect to the CCP, the CCP can relay messages between any of them.
Below you can watch an animation that goes into more detail about information flow in the CCP:
There is an additional function that the CCP performs, and this is of great importance. Because all information flows through the CCP, a high-level AI agent can use the Central Control Program as a point of centralized control (hence, the name). We established earlier that the CCP passes messages between programs, but there is more! When the CCP receives a message, the first thing it does is check the To: field; if the To: field reads "CCP," then the message is an order for the CCP to perform some work. For instance, the CCP might, on behalf of ProtoThinker, check to see if the Text-to-Speech Engine is turned on. Or, the CCP might be asked to disconnect a malfunctioning module by a watcher program that has spotted errors.
However, if the message is not intended for the CCP, it is passed on to the Mind Module, which reviews and OKs all messages before the CCP forwards them to their intended recipients. The Mind Module can block the CCP from sending messages, create and send messages of its own, modify messages before they are sent, and even spoof messages - that is, the Mind Module creates messages that purport to come from other CCP-clients, but are really from the Mind Module (this is not as devious as it sounds, and applications can benefit from this activity). The Mind Module has the potential to be the smartest, most powerful AI program that Iris has. However, the Mind Module is still being designed and as of now, ProtoThinker is Iris's smartest AI agent. In summary, the CCP allows the Mind Module to control information flow, and thus the robot, itself.