Burst Time: It defines the usage time of CPU by
the process. Some time-critical processes require not
to be interrupted. Therefore, assigning a burst time is
useful for this kind of processes.
Priority: It defines priority of the process. Some
scheduling algorithms need this data for permitting
the processes with high priorities to be processed
first.
Command Buffer: The device processes, also
sometimes user-defined processes, perform the task,
which serves the related device to the clients. The
device should be commanded by the client, and the
command buffer keeps the client commands.
Data Buffer: If applicable, processes store the
obtained data after the required task is executed into
this buffer.
Memory Limits: If a process uses a memory
block, the starting address and size of the memory
block is kept here.
Reserved: The PCB contains a suitable-sized
space for the purpose of possible extension of the
system in the future.
Process State: the CPU scheduling module uses
this part. It consists of flags, which define the state
of process. States of the process are defined as;
Terminated: It defines the fact that the process
has finished.
Ready: It defines the fact that the process is
ready to be executed.
Waiting: It defines the fact that the process has
interrupted, and it is waiting for a continuation
signal.
Blocked: It defines the fact that the process is
valid; however, it cannot be executed. For instance,
there is a device driver program for electronic
compass; however, the device either has not been
installed or it is faulty.
2.2 Processes
There exist two types of processes: device processes
and user-defined processes. The device processes
take the commands from their own command buffers
in PCBs. They run according to the commands, and
then load the data to their own data buffers in PCBs.
The state of the process becomes ready while the
command is loaded. Thus, the CPU scheduling
module automatically adds this process to the queue
for execution.
User-defined processes are slightly different than
device processes. They implement the tasks not
necessarily for serving to clients. For instance, a
user-defined process can do emergency stop when
the robot hits any obstacle. These processes are
necessary for reactive system when either there is a
lack of communication or the client commanded
robot by mistake. The user-defined processes may
also serve to clients. For instance, it can send
information about the system, such as system errors,
system configuration, etc.
The server process provides the communication
with clients. It is called in device processes, but its
internal structure is defined by the architecture. The
main goal of the server process is to provide
continuous communication between mobile robot
and clients, which can be a PC, or any other mobile
robot. A simple packet format is used for
communicating with clients. There are two types of
packet formats as given in Figure 3.
Figure 3: Communication Packet Formats
Both types of the packets start with a special
character to eliminate the unwanted packets and
determine the starting point of the packet. The
second and third bytes contain sender id and receiver
id, respectively. Since the system is designed for the
mobile robot to be commanded by multiple clients,
these identifiers are necessary. The length of the
packet clarifies how many bytes are there on the
remaining parts of the packet. This information is
useful for implementation purposes. The following
content of the packets have differences between
command and data packets. The command packet
includes device id and command id together which
are codes assigned for every device and command,
respectively. The argument of the command should
be given, if applicable. The data packet contains just
device id to identify the data producer, and data
required by clients. There is a check sum at the end
of both packets to check the correctness of the
received packet. Clients send the command packets,
and the mobile robot system sends data packets.
First, the server process listens to the serial port
for a command. If the received command is valid, its
checksum is determined to check the correctness of
the command. Also, the receiver id is compared with
the id of the mobile robot. Then, it loads the
command with sender id into the command buffer of
the related device process. Second, the server
process sends the ready data to clients one by one. It
looks at the data buffers of the processes listed in the
ICINCO 2005 - ROBOTICS AND AUTOMATION
72