Page 105 - Designing Autonomous Mobile Robots : Inside the Mindo f an Intellegent Machine
P. 105
Chapter 6
If these public variables are treated as individual class members instead of elements
of arrays, then they will need to be read from and written to disk by their individual
names, and there is no simple manner of requesting them in a message protocol. In
large systems, this can lead to very long blocks of code that can easily become
unmanageable.
Communications architectures
The communications architecture describes who initiates messages, and who pas-
sively receives them. There are two basic architectures: master-slave and peer-to-
peer. By far, the most common and easy to implement architecture is the master-
slave structure.
The master-slave architecture
The master-slave architecture operates like a classroom. The master initiates all com-
munications and the pupils (slaves) respond. If a slave wishes to inform the master
that it has data it would like to bring to the master’s attention, it posts this fact in a
flag that the master regularly tests. This is like a pupil raising a hand. When the
master reads this flag it will make further inquiries as indicated.
A master-slave architecture is much simpler to implement than a peer-to-peer
system because there is no danger of message collisions. Collisions occur when two
agents both decide to transmit a message at the same moment.
Peer-to-peer architectures
In a peer-to-peer architecture, any agent on the link can send a message to any other
agent. This architecture can be more responsive than the master-slave approach, but
it is considerably more complicated to actually implement. Ethernet networks are
peer-to-peer by nature.
In the master-slave approach, the master decides what the system is going to be
doing, and it goes about sending the appropriate messages to the slaves. It will then
monitor the status of each slave to determine if it can continue with the plan. If
something goes wrong, the master finds this out at a predetermined decision point of
its program.
88

