In ordinary port-based modules and agents, all communication is directed through its ports. However, in order to interface with hardware or with legacy software, some communication must occur through other means (e.g., sockets to the hardware) that we call resource ports. Modules that communicate in such a fashion are port-based drivers.
Port-based drivers must implement the interface Driver. This interface has no methods, but is merely a marker interface that indicates that a module implementing it is allowed to communicate through resource ports.
Though our port-based agent architecture is a powerful method for writing and using software, it is far from the only way to create software. It especially does not make sense to rewrite existing software whose performance is satisfactory just to work it into our framework.
One of the uses of port-based drivers is to communicate with this existing software. For example, a driver agent to control a video camera.
As our software has been developed primarily as a method for controlling mobile robots, we need to have agents to control different pieces of hardware in the robots.
One of the methods for doing this was seen in the example above, where we interfaced with existing C code to control and receive information from a video camera.
Need something else too that anyone can do on any computer, maybe an example using comm.jar so that the java talks directly to the hardware
CyberRAVE is the software package developed and used by the Advanced Mechatronics Lab at Carnegie Mellon University for controlling both real and virtual mobile robots. This part of the tutorial assumes that you have access to CyberRAVE and know how to use it.
To interface with CyberRAVE, we use a small dummy
program responsible for bouncing sensor and control messages to/from the
port-based drivers and CyberRAVE. Since
CyberRAVE uses the same directory server as PB3A,
we register one dummy program
for each robot with the directory and each driver can use that information to
open sockets to the proper location and port.
To simplify the procedure, a subclass of PBAgent, PBSAgent, was created
that contained all the methods necessary to communicate with the dummy.
The important methods are initMessages(),
to initialize the messaging and inform the dummy that this driver exists;
registerForMessage(),
which tells CyberRAVE to send messages of a particular type to this location; receiveMessage(),
which takes action whenever a message is received; sendMessage(),
which transmits a message to the dummy; and endMessages(),
which sends any necessary final messages and closes down communications.
Two examples of these drivers are PBAPioneerSonarDriver and PBAPioneerActuatorDriver. The former reads the sixteen sonars that ring the Pioneer robots we use in the lab and package them into a class of type PioneerSonarData, while the latter takes commands of the class PioneerCommand and drives the robot around accordingly.
We can test these drivers by using them to let the robot wander around with PBARandomWander, which makes the robot wander around while using the sonars to avoid obstacles. To test, start PB3A and CyberRAVE. Start the dummy program on the robot you'll use, making sure to give it the proper address of the directory server. Then compose a configuration with PBAPioneerSonarDriver, PBARandomWander, and PBAPioneerActuationDriver. Launch the configuration, and voila, the robot wanders around its environment.
| Prev | Next |
Copyright 2000, Carnegie Mellon University
This page written by Jonathan Jackson
Last modified: Fri May 19 15:51:46 EDT 2000