#### Abstract

This paper presents a new algorithm for real time event detection using Finite State Machines with multiple Fuzzy Logic Probability Evaluators (FLPEs). A machine referee for a robot soccer game is developed and is used as the platform to test the proposed algorithm. A novel technique to detect collisions and other events in microrobot soccer game under inaccurate and insufficient information is presented. The robots' collision is used to determine goalkeeper charging and goal score events which are crucial for the machine referee's decisions. The Main State Machine (MSM) handles the schedule of event activation. The FLPE calculates the probabilities of the true occurrence of the events. Final decisions about the occurrences of events are evaluated and compared through threshold crisp probability values. The outputs of FLPEs can be combined to calculate the probability of an event composed of subevents. Using multiple fuzzy logic system, the FLPE utilizes minimal number of rules and can be tuned individually. Experimental results show the accuracy and robustness of the proposed algorithm.

#### 1. Introduction

For the past years, robot soccer games are played without human intervention; however, the games are refereed by a real person [1, 2]. If it is meant to be a real robot soccer game, then the human referee is better replaced by a machine. This machine referee is somewhat similar to the robot intention extraction problem [3].

Among the decisions made by a human referee for a robot soccer game, giving score or goal point is the most critical because it directly decides the winner of a game. For that matter, to detect goalkeeper charging fouls is very crucial in order to decide and give correct score points to a team [4].

A charging foul decision is a special case of detecting collisions between robots because the information given to the system is inaccurate and insufficient [5, 6]. The decision is dependent on the positions and the actions of the robot defensive goalie and the robot attacker/shooter. Based on the Federation of International Robot-Soccer Association (FIRA) rules [2], a goalkeeper charging foul is called when an attacker or a shooter directly pushes the goalkeeper away from its current position. The attacker robot is permitted to push the goalkeeper only through a ball in between them. However, even if there is a ball between the attacker and the goalkeeper, pushing the goalkeeper passed the goal line is considered a charging foul.

The multiple robot tracking and object collision detection has been widely researched [7–12]. Literature review reveals that the exact shapes and coordinates of objects must be given so that the knowledge of the physics can be utilized [8, 13–15]. However, in this study to use the former method of collision detection is not possible because based on FIRA rules, the information given to the system is only the team color and the individual robot identity color using colored patches placed on top of the robot. The shape and size of the colored patches are open for a team to decide. Thus the real time information available to the robot soccer event referee system is inaccurate and insufficient because of the limitations of the camera vision system [5, 16, 17]. This makes this problem very challenging and interesting to solve.

In this paper, finite state machines with multiple fuzzy logic probability evaluators algorithm are used in developing and implementing an event referee for a robot soccer game. A state machine is assigned to detect a specific event. It uses the probabilities of event occurrence calculated by fuzzy logic probability evaluators (FLPEs) and threshold crisp probability values to discern if the events certainly happened. The process is administered by a main state machine that initiates other state machines based on situational conditions of the game such as the actual position and velocities of the robots and the ball. The system developed has extendible structure for using other state machines modules so that new features of the machine referee can be easily added and adopted.

This paper is organized as follows. Section 1 discusses the scope and direction of the research. Section 2 discusses the mechanics of robot soccer identification and collision detection. Section 3 discusses the design architecture of the proposed event referee system for the robot soccer game. Section 4 discusses the fuzzy logic probability evaluator algorithm to calculate the crisp value of the type of events that triggers. Section 5 presents the experiment results with analysis and discussions. Finally, Section 6 presents the conclusion and recommendations.

#### 2. The Robot Soccer Identification and Collision Event Detection

The mechanics of the Microrobot Soccer Tournament are formulated by FIRA [1, 2]. The actual size of the robot is 7.5 cubic centimeter [18]. Each robot is identified by a camera vision system through the two colored patches on the top part of its body [16]. Each team has an assigned patch color while each robot’s identity has a designated patch color. The team color is either yellow or blue. The individual robot identity color can be of any color except yellow or blue. The size and shape of each team and individual robot colored patches is not given provided that it should not exceed 3.5 square centimeters [5].

##### 2.1. Collision Event of Two Robots

The robot collision event can be divided into 3 subevents. The first event is when a robot moves close toward another robot. The second event is when a robot strikes another robot resulting in its decreased speed, and the third is when both robots move in two general ways as shown in Figure 1. The case in Figure 1(a) is the two robots bounced. It is called “Hitting.” The other case in Figure 1(b) is the two robots move together like one object as they try to push each other. It is called “Pushing.”

**(a)**

**(b)**

It is important to note that the goalkeeper will move toward the ball when the ball is near the goal to prevent the ball from going inside the goal. Other robots will also show the same behavior to attempt to possess the ball, especially when opponent robots are close by. In addition, the goalkeeper usually moves parallel to the goal line to effectively protect the goal area. When the goalkeeper moves perpendicular to the goal line with considerable speed, then it gives a certain degree of evidence of a collision. This is illustrated in Figure 2.

**(a)**

**(b)**

##### 2.2. Types of Events

A frame is the captured image of the physical scene at a moment, and the frame information includes the coordinates and speeds of the robots. The type of events in a robot soccer game can be divided into two groups based on the number of frames needed to detect the event. These groups are as follows:

(1)the events that can be detected with one frame information; for example, two objects are in the goal area at the same time; this can be detected with the coordinate information of two objects in one frame;(2)the events that can be detected using more than one frame information; for example, a stalemate for 10 seconds; this can be detected only after checking all the frames for 10 seconds.Also, the events can be categorized according to the number of subevents:

(1)primitive events: the events that do not have subevents; for example, the ball is near the robot. (2)composite events: the events that have subevents; for example, the collision event has 3 subevents as described in Section 2.1.##### 2.3. Motions and Orientations of Two Robots during Two Consecutive Frames

Figure 3 shows the motions of two robots before and after capturing two consecutive frames. In here, *Robot A* moved downward and *Robot B* moved upward. There are four important parameters that are needed to describe the dynamics of the two robots.

*Robot A*. The origin is the center of the team’s colored patch of

*Robot A original position*, and the destination is the center of the team’s colored patch of

*Robot A new position*. (2)DV1 represents the distance between

*Robot A new position*and

*Robot B new position*. (3)DV2 represents the distance between

*Robot A original position*and

*Robot B new position*.(4) represents the angle between SV and DV2. Note that the smaller value of means that

*Robot A*moves toward

*Robot B*. The DV and SV of other objects like the ball can be defined in the same manner.

#### 3. The Robot Soccer Game Event Referee System

The architecture of the robot soccer game event referee system developed in this research is shown in Figure 4. This is composed of two main parts: (1) the vision system, and (2) the decision making system. The vision system is the same as the one used in the remote-brainless vision-based soccer robot system [7]. It is composed of a digital camera overlooking the robots and connected to a host computer. The vision system provides the frame information like the coordinates and direction of the robots [16–18].

The decision making system will detect events like pushing, hitting, stalemate, ball shot, and others by inspecting the frame information. The fuzzy logic probability evaluators (FLPEs) give the probability of the occurrence of events. The state machines (SMs) use a threshold crisp probability value. For example, if the threshold value of an event is 80%, the event will be regarded as it happened when the probability of its occurrence calculated by the FLPE is above 80%. The detail about an FLPE is discussed in Section 4.

##### 3.1. Multiple State Machines

The Main State Machine (MSM) shown in Figure 4 is the heart of the robot soccer game referee system. The MSM uses a vision system to align its action with the State Machines (SMs). It initiates the State Machines (SMs) based on heuristic rule using . For example, if an opponent robot is within 20 cm distance from the goalkeeper robot, then the MSM will initiate the to detect possible goalkeeper charging. The is initiated only when the event it detects has the probability to occur in order not to waste the resources of the host computer. The MSM also makes final decisions, for example, if an SM notifies a “goalkeeper charging” while another SM reports a “goal shot”, the MSM ignores the “goal shot” event and takes the “goalkeeper charging” event.

It is easy to modify or extend the event referee system by adding a state machine for a new situation and updating the rule base of the main state machine to accommodate this condition. Figure 5 shows a sample Finite State Machines for detecting goalkeeper charging and stalemate. The events like are detected by Fuzzy Logic Probability Evaluators (FLPEs) and threshold crisp probability values. For example, if the threshold value is set at 80%, an event with the probability higher than 80% will be regarded as if it actually happened. The threshold values may be set differently for each event or the same for all events. The details and explanation of the actions taken from Figure 5 are described in Table 1 with the following definitions.

*FLPE(n)*is the fuzzy logic probability evaluator for a given specific number

*n*.

*P(En)*is the probability of the event

*En*calculated by

*FLPE*for

*En*at frame

*n*.

*TPn*: is the threshold Probability for

*En.*

#### 4. Fuzzy Logic Probability Evaluators *(FLPEs)*

The *FLPEs *are designed to find probabilities of the occurrence of events. There are basic *FLPEs* for primitive events and composite *FLPEs* for complex events. A composite *FLPE* consists of *FLPEs* for each sub-event of the complex event. The probability of an event to occur is defined in fuzzy linguistic terms shown in Figure 6. These terms are used for all other *FLPEs*. Since we are less concerned with low probability, it is defined as *VL (Very Low)* with larger area. The descriptions of each *FLPE *are given in Table 2. The input variables to some *FLPEs* are explained as well.

##### 4.1. Probability Combiner (*FLPE1*)

The probability combiner *FLPE1* is used to combine probabilities of subevents to get the probability of a complex event. *FLPE1* basically gives the probability of an event composed of two subevents. By using *FLPE1 *consecutively, the probability of an event composed of many subevents will be calculated. The *FLPE1* is used to find the probability of composite events composed of two subevents. It uses 2 crisp probabilities for each sub-event of a composite event as inputs and gives the crisp output probability for the composite event using the center of gravity deffuzification.

The probability of a sub-event that actually happened could have low value due to the inaccurate data from the vision system. Also, the behavior of objects is continuous. Therefore, the probability of a sub-event could be low if the frame is taken after a moment that could be characterized as the sub-event. The subevents of an event occur in sequence or at the same time. Though the probability of one sub-event is very low, if the probability of the other sub-event is very high, then the probability of the event composed of these two subevents can be said as medium. It is to think that the high probability of a sub-event gives certain evidence that the other sub-event is triggered despite its low probability. The FAM on Table 3 gives all these rules based on the algorithm in Table 4. This can be interpreted as follows:

**IF** P1 is VL (very low) and P2 is VH (very high) **THEN** the probability of the event composed of subevents 1 and 2 is M (medium).

##### 4.2. Collision Probability Evaluator (*FLPE2*)

The *FLPE2 *calculates the probability of a robot’s collision with another robot given the frame information of two robots such as speed vector and distance vector (refer to Section 2.3). This is composed of two *FLPEs* that are also composed of other *FLPEs*. The first is to detect the “Hitting” type collision *(FLPE3)* and the second is to detect the “Pushing” type collision *(FLPE8)*.

In Figure 7, *FLPE3 *has two types of “Hitting” conditions. The left part detects the event when an opponent robot hits the goalkeeper and the goalkeeper moves perpendicular to the goal. The right part detects the event when a robot hits another robot and prevents that robot from going to the ball. This applies not only for the goalkeeper but also to all other robots. Whichever has the higher probability between the two parts will be selected for the “Hitting” type collision event.

*FLPE8* shown in Figure 7 uses three subevents *FLPE4, FLPE5,* and *FLPE9* to detect the “Pushing” type collision event. Note that *FLPE1 *is again used to calculate the final fuzzification of these three subevents. Finally, the higher probability value between two probabilities of “Hitting” and “Pushing” will be selected as the probability of a collision event between two robots.

From Section 2.1, there are three subevents of collision. The first sub-event is a robot moving close toward another robot in one frame, and the other two subevents happen together at the next frame. Thus, to get the probability of a collision at frame *N*, the output of *FLPE4* for the first sub-event should be taken from the previous frame of frame *N* while the outputs of the other two subevents are taken from the current frame *N*.

##### 4.3. Probability Evaluator for an Event That a Robot Moved Closer Toward Another Robot (*FLPE4*)

The *FLPE4* uses 3 input variables.

*D*is the distance between

*Robot A new position*and

*Robot B new position*(in cm).(2) is the angle between

*Robot A new position*and

*Robot B new position*based from

*Robot A old position*(in degrees)

*.*(3) is the speed of approaching

*robot A*(in cm/frame).

The *FLPE4 *initially uses inputs *D and * to calculate the temporal probability of the event using the membership functions in Figures 8 and 9, and the rules in Table 5. When *D* and have small values, it is more probable that a robot moves close toward another robot. Note that due to vision system difficulties, even when the robot is not moving, the value of *S _{a}* can be nonzero: it is usually lower than the value of

*S*obtained when the robot actually moves. To distinguish this error from the actual movement, the membership function of

_{a}*S*is defined as shown in Figure 10. The final probability is calculated as the product -norm of the temporal probability and the membership value of

_{a}*S*. For example, if

_{a}*S*is 0, then the membership value is 0 and the final probability becomes 0. If the

_{a}*S*membership value is 1, then the final probability equals the temporal probability.

_{a}#### 5. Experimental Results

In order to prove the robustness of the system, various experiments were conducted. These were done using different types of patches to show that the system is not dependent on a single patch design. Also, the experiments were conducted in various locations and orientations within the playing field. The captured images of continuous frames and the values of *FLPEs *for various cases are shown in this section. Note that in these experiments, a heuristic value 84% was used for the threshold value for all *FLPEs*. This crisp value is between the fuzzy linguistic probability terms H (for high) and M (for medium). The abbreviations below are used and are defined to simplify the analysis.

*FLPE3,*for deciding a “Hitting” type of collision.PO4:is the crisp probability output of

*FLPE4,*for deciding that a robot moved closer toward another robot.PO5:is the crisp probability output of

*FLPE5,*for deciding that a robot swiftly decreased its speed near another robot.PO6:is the crisp probability output of

*FLPE6,*for deciding that a goalkeeper moved perpendicular to the goal linePO7:is the crisp probability output of

*FLPE7,*for deciding that a goalkeeper moved away from the ball.PO8:is the crisp probability output of

*FLPE8,*for deciding a pushing type of collision.PO11:is the crisp probability output of

*FLPE11*, for deciding that a ball is between two robots.PO12:The crisp probability output of

*FLPE12,*for deciding that a ball is on or beyond the goal line.

##### 5.1. Goal Decision

Figure 11 shows the four consecutive frames of a real time event of a goal score experiment. In this case, the attacker successfully made a goal without striking the goalkeeper as the goalkeeper was late to defend the goal. From Table 6, the values of hitting collision PO3 and pushing collision PO8 are below the threshold value 84% which means that no collision occurred between the two robots. The attacker robot swiftly decreased its speed as it went nearer the goalie, as shown in the higher value of PO5 at Frame 3. The system correctly declared a “goal score” at the 3rd and 4th frames as shown from the values of PO12. The robustness of the system can be seen from other indicators through smaller values of PO4, PO6, and PO7. Figure 12 shows the summary of this result.

**(a)**

**(b)**

##### 5.2. Goalkeeper Charging Decision (Pushing)

Figure 13 shows the six consecutive frames of a real time event for a goalkeeper charging foul decision. Table 7 shows the *FLPEs *crisp values for the six frames. At frame 1, the attacker brings the ball towards the goal area with the goalie guarding in front of the goal area. At Frame 2, the attacker moves fast and reaches the goalie position with the ball situated between them. This can be verified from the higher value of PO4 and PO11. At Frame 3, the goalkeeper holds his defense position which can be verified from higher values of PO6 and PO7. At Frame 4, the attacker continuously pushes the goalkeeper towards the goal area but still no foul is called because the ball is in-between them. This can be verified from high values of PO4 and PO11, at the same time lower values of PO3, PO8, and PO12. At Frame 5, the Pushing and Hitting collisions are detected which can be verified from values of PO3 and PO8 that are both above 84%. However, the ball is still in between the robots and the goalkeeper did not pass the goal line which can be verified from the values of PO11 and PO12; hence, goalkeeper charging decision is not yet called. At Frame 6 when the goalkeeper passes the goal line together with the ball, a goalkeeper charging has been decided due to pushing collision that can be verified from the higher value of PO8 and lower value of PO3. Note that PO5 values are still low because the attacker is slow and there is no big difference of the speed when it hits the goalkeeper, but the large values of PO4 and PO7 justify this decision. All of these conditions can be verified at Table 7 and summarized at Figure 14.

**(a)**

**(b)**

##### 5.3. Goalkeeper Charging Decision (Hitting)

Figure 15 shows the six consecutive frames of the real time event for goalkeeper charging decision caused by hitting collision. To show the robustness of the system developed, different types of team patches are used for the goalkeeper in this experiment. In here, the attacker comes from the right side of the goal area. From Table 8, at 4th frame, the value of PO3 which is hitting collision is above 84%. Hence, the system decides for a goalkeeper charging even though the ball is between the two robots because the goalkeeper has reached the goal line position. This can be verified from the higher values of PO11 and PO12. Table 9 shows the result of various experiments conducted using this team patch. It can be seen from here that the system is very accurate with a success rate of 96%.

##### 5.4. Stalemate Decision

Figure 16 shows the condition for stalemate decision. In here, the ball is not moving and the robots are stuck. The FLPEs give low probabilities of robots moving to the ball. After 10 seconds is counted by the computer clock, the referee system calls for a stalemate or a free-ball decision.

##### 5.5. Goal Score Decision

There is no case that the “goal score” is incorrectly declared even though in some cases, the attacker robot passes very near the goalkeeper robot, which can be misjudged as a “goalkeeper charging”. Table 10 shows the experiments results. The AP is the average probability of collision calculated by the fuzzy logic evaluators.

##### 5.6. Discussion and Analysis

The system developed was tested for various situations of collision events to get the machine referee decision. Experiment results showed very high accuracy and robustness of the system. This was due to many indicators used together and applying fuzzy logic approximate reasoning capability for dealing with inaccurate data.

Most failed cases were caused by the vision system. When the robot covered the ball and moved together with the ball, the vision system failed to trace the ball due to the small number of pixels captured. For this, a heuristic technique was used. If an FLPE needed the position of the ball and the vision system cannot locate it, it used the FLPE value of the previous frame. However it was found out that if the vision system loses the trace too early, the referee system failed to detect some events such as the ball was between two robots and the ball was near the goalkeeper. This can be solved using a vision system with high resolution as it may trace the ball better.

#### 6. Conclusions

An event referee system for microrobot soccer game was developed. Robot goal shots, charging fouls, held ball, and stalemates are samples of events that the system can determine accurately. The algorithms in detecting robot collisions under the condition of inaccurate and insufficient information were presented. The paper introduced fuzzy logic probability evaluators for multiple state machines as a novel way to calculate probabilities for events decision making. Experiment results gave very high success rate and robustness even though the input information is not accurate and insufficient. This was due to the integration of many indicators together and using fuzzy logic’s capability for dealing with uncertainties. Other functions of the machine referee decision can be added and integrated into the system easily due to its extendible structure design using multiple state machines. With the combination of multimedia functionality, the system will be able to facilitate the Microrobot Soccer tournament game actively in the future. The algorithm developed has extendible structure that can easily be applied to other applications or problems. This can be used for other event detection researches as an alternative to using crisp logic.

The authors conducted other techniques to solve the robot soccer game event detection problem. Experiments like curve fitting and direct heuristic or rule based approach were implemented. However, the results of these techniques were not encouraging because the inputs of the system which are taken from the camera are subject to extreme noise that can vary abruptly. The proposed technique using the weighted sum and cascaded or multiple fuzzy logic probability evaluators is very effective in filtering the noise. For future works the authors will implement this proposed technique in developing humanoid behavior.

#### Acknowledgments

The authors would like to acknowledge the support provided by the administrators of the De La Salle University and the DLSU Science Foundation that insured the success of this research.