The Multitasking System of Swarm Robot based on Null-Space-Behavioral Control Combined with Fuzzy Logic

A swarm robot is a collection of large numbers of simple robots used to perform complex tasks that a single robot cannot perform or only perform ineffectively. The swarm robot works successfully only when the cooperation mechanism among individual robots is satisfied. The cooperation mechanism studied in this article ensures the formation and the distance between each pair of individual robots while moving to their destination while avoiding obstacles. The solved problems in this article include; controlling the suction/thrust force between each pair of individual robots in the swarm based on the fuzzy logic structure of the Singer-Input-Singer-Output under Mamdani law; demonstrating the stability of the system based on the Lyapunov theory; and applying control to the multitasking system of the swarm robot based on Null-Space-Behavioral control. Finally, the simulation results make certain that all the individual robots assemble after moving and avoid obstacles.


Introduction
A flock is a gathering of a group of creatures, found in nature of many different species such as insect pests, ants, bees, termites, fish, etc. Flocking behavior can accomplish tasks that surpass the ability of the individual. So, researchers have modeled flocking activity, inheriting these advantages to apply to multi-robots. By the end of the 1980s, scientists had researched and built robotic teams with the capability of working and coordinating to perform a specific task [1].
In order that the robot individuals of the swarm can work together to perform a certain task, the first and most important problem that must be addressed is ensuring a collaborative mechanism among robots. When an individual robot performs a task, it must avoid obstacles, but it is not separated or cannot collide with others [28,29]. So, before researching the specialized applications of the swarm robot, the first problem that needs to be solved is ensuring the swarm and the distance among individuals while moving and avoiding obstacles. Some researchers have solved the above problem as in references [30][31][32][33]. All of these studies are on the interaction between each pair of individuals and between the individual and the environment. The interactions are expressed by the suction/thrust force among individuals, usually explicit mathematical functions, but there is no convincing explanation. In reality, the working environment of the swarm robot is quite complex, frequently changing, and each robot consists of a collection of many details such as the engine, power circuit, control circuit, etc. so it is difficult to determine an explicit mathematical model, or even impossible to identify.
In order for the model system to get closer to nature, this article proposes a solution which uses fuzzy logic for controlling the suction/thrust force between each pair of individuals in the swarm. The advantage of this solution is that the object can be controlled easily without the requirement of knowing the object mathematical equation. Then, the authors applied this method to control the multitasking system of a swarm robot.
Multitasking in a swarm robot means that each individual robot in the swarm must perform multiple tasks at the same time; research [34] has also introduced two basic mechanisms to solve the multitasking problem as follows: The first is an arbitration mechanism: the controller only obeys the output commands of the higher-priority behavior. The lower-priority behavior can only be performed if the output of the higher-priority behavior is equal to zero. The drawback of this mechanism is that when the behaviors are not inconsistent with each other they still cannot be done at the same time.
The second is the integration mechanism: The command is created based on a combination of several behaviors. The drawback of this mechanism is that when the behaviors are inconsistent with each other, they cannot be done at the same time.
Thus, the arbitration mechanism (competition) only allows one task at the same time, so this mechanism is rarely used. The integration mechanism allows for combining several tasks to achieve a different mission, but it is difficult to perform conflicting tasks. Research [35] has introduced a new method to solve the above limitations, which is the null space behavioral (NSB) control method. Based on this method, the complex task of the swarm robot can be divided into different basic tasks (behaviors), these tasks are properly combined to achieve the objective mission. The main steps of this method are determining the priority assignment of each basic task, then projection of the lower-priority tasks on the null-space of the higher-priority task.
So, the current authors combine the two best-fit methods to control the swarm robot: the first is using fuzzy logic to control the suction/thrust force among the individual robots. The advantage of this method is that the object can be controlled easily without the requirement of knowing the mathematical equation; the second is using the null-space behavioral control method for the multitasking system of swarm robot. The advantage of this method is that it allows the robot to perform many tasks easily at the same time.

Building the Function of the Suction/Thrust Ford Based on Fuzzy Logic
Considering a set of N individuals in n-dimensional Euclidean space (n ≤ 3). Assume that each individual is a point and ignore their size and mass, the position of the individual (i) in the swarm is The movement of individual robots in a homogeneous environment will depend on the interaction between the individual and all other individuals. The homogeneous environment is an environment where there is no obstruction, no external disturbance affecting the swarm. If pairs of individuals are far apart, they need to move toward each other by suction force in order to maintain the swarm. Conversely, if pairs of individuals are near together, they need to move away from each other by thrust force to avoid collisions. So, the interplay among individuals in the swarm will depend on the distance between the pairs of individuals. The interaction force between two individuals (i and j) is defined as follows: where: p j − p i is the distance between two individuals i and j.
The actual distance between two robots (i and j): Named: where: g(·) is the suction/thrust force between two individuals (i, j), g a (·) is the thrust force, g r (·) is the suction force. σ * s ∈ R is the distance between two individuals i and j, where the suction force and thrust between the two individuals are in equilibrium, which means: σ s is the error between the real distance and the desired distance: The interaction force f(σ s ) among individuals in the swarm is a nonlinear function that depends on the distance between each pair of individuals (i, j). So, we can construct the function f(σ s ) based on a Mamdani fuzzy system with the Singer-Input-Singer-Output (SISO) structure as follows: The input signal is u = ∼ σ s = σ s − σ * s , assume that the value domain of u is [α b , β b ] ∈ R, divide this domain into 2Nf + 1 in the range B k as shown in Figure 1. The output signal is A = f(σ s − σ * s ) with the value domain [α a , β a ], divide this value domain into 2N f + 1 in the range A k as shown in Figure 2 (k = 1, 2, . . . , 2N f + 1). a k is the focus of the fuzzy range A k : where: p − p is the distance between two individuals i and j. The actual distance between two robots (i and j): Named: where: g(·) is the suction/thrust force between two individuals (i, j), g (·) is the thrust force, g (·) is the suction force.  * ∈ R is the distance between two individuals i and j, where the suction force and thrust between the two individuals are in equilibrium, which means: is the error between the real distance and the desired distance: The interaction force f( ) among individuals in the swarm is a nonlinear function that depends on the distance between each pair of individuals (i, j). So, we can construct the function f( ) based on a Mamdani fuzzy system with the Singer-Input-Singer-Output (SISO) structure as follows: divide this domain into 2Nf + 1 in the range B k as shown in Figure 1.  The output signal is A= f( −  * ) with the value domain [αa, βa], divide this value domain into 2Nf + 1 in the range A k as shown in Figure 2 (k = 1, 2, …, 2Nf + 1). a is the focus of the fuzzy range A k :     • The second step: establishing 2Nf + 1 rule IF-THEN with the form: The third step: defuzzifier using the central area method, we have control laws as follows [36]: With the solution to design the fuzzy control through the above three steps, the relationship between the input signal and the output signal is the relationship between the distance and the interaction force between individuals (i, j): The fuzzy function f(σ s ) is a continuous function which satisfies the following conditions:

•
Upper and lower limits: The equation of a part linearization: where: u ∈ u k , u k + 1 , k ∈ {1, 2, . . . , 2N f } G amin , G amax is the smallest and largest value of the suction force, G rmin , G rmax is the smallest and largest value of the thrust. From (6) we can find the limits of the function g(σ s ) as follows:

The Stability of the System
Assume that the individuals move in sync and have no delay, all individuals in the swarm know exactly the relative position of all other individuals, the dynamic Equation (1) can be rewritten as follows: where: (p j −p i ) p j −p i displays the direction of the force from the individual (i) to the individual (j), f p j − p i is the interaction force depending on the distance between the pair of individuals (i, j).
If g(·) > 0, this interaction is the suction force, if g(·) < 0, this interaction is the thrust. The center of the swarm is defined by the following formula: The derivational of the center p c : The Equation (10) shows that the center of the swarm robot described by the Equation (8) where the suction/thrust force as Equation (3) is invariant.
The different position between individual (i) and the center is as follows: The derivational of e i : Select the Lyapunov function for the individual robot (i): The derivational of V i : The sum of Lyapunov functions of all individuals: The derivational of V: where: Named: Equation (14) can be rewritten as follows: From Condition (5), we infer: Considering the second component of Equation (15): The left side of the Inequality (16): Set β is the largest value of f S 2 in the domain S 2 . The graph of total f S 2 is shown in Figure 3. Named β = A min σ * s . So:  Thus, the Inequality (16) is equivalent to: The first component of Equation (15): Named α = min G , A , we have: Combination of Inequalities (16) and (18), with p − p ≤  * , (i, j) ∈ S , we have: From the definition of the swarm robot center, we have: Two sides of (20) minus Ne , we have: Thus, the sum of the squared deviations is given by the formula: Combining Equations (17) and (21) we have: Thus, the Inequality (16) is equivalent to: The first component of Equation (15): Named α = min{G amin , A min }, we have: Combination of Inequalities (16) and (18), with p j − p i ≤ σ * s , (i, j) ∈ S 2 , we have: From the definition of the swarm robot center, we have: Two sides of (20) minus Ne i , we have: Thus, the sum of the squared deviations is given by the formula: Combining Equations (17) and (21) we have: 2Nα . So, we can conclude with the following theorem: Theorem: Swarm robots are modeled by Equation (8) with the fuzzy control law of suction/thrust force constructed according to (3), satisfying Conditions (4). After a period, all individuals of the swarm will be converged in a restricted area by: 2Nα is the convergent radius of the swarm.
The effect of the parameters on the restricted area of the swarm (Ω σ ) is as follows: • If A min increases, the thrust increases, the restricted area of the swarm robot increases.

•
If α increases, the restricted area of the swarm robot decreases.

•
If the size of the swarm (N) is bigger, the restricted area is lower.

Multitasking-Control System of Swarm Robot
When the robots perform the task of moving to a destination, on the way they must avoid obstacles. So, each robot in the swarm has three tasks as follows:

•
The first task is avoiding obstacles • The second task is moving to the destination.

•
The third task is maintaining the swarm: Avoiding collisions among individuals in the swarm, but not splitting the group.
In order for the robot to perform the above tasks, the supervisor selects the priority of the tasks. In this study, the priority of the tasks in order is: Avoiding obstacles, moving to the destination, and maintaining the swarm. Assume that the obstacles are static and are known then the speed vector of each robot based on the null-space behavioral control technique [36] is calculated according to . So, we can conclude with the following theorem: Theorem: Swarm robots are modeled by Equation (8) with the fuzzy control law of suction/thrust force constructed according to (3), satisfying Conditions (4). After a period, all individuals of the swarm will be converged in a restricted area by: where σ =  * =  * is the convergent radius of the swarm.
The effect of the parameters on the restricted area of the swarm ( σ ) is as follows: • If A increases, the thrust increases, the restricted area of the swarm robot increases.

•
If α increases, the restricted area of the swarm robot decreases.

•
If the size of the swarm (N) is bigger, the restricted area is lower.

Multitasking-Control System of Swarm Robot
When the robots perform the task of moving to a destination, on the way they must avoid obstacles. So, each robot in the swarm has three tasks as follows: • The first task is avoiding obstacles • The second task is moving to the destination.

•
The third task is maintaining the swarm: Avoiding collisions among individuals in the swarm, but not splitting the group.
In order for the robot to perform the above tasks, the supervisor selects the priority of the tasks. In this study, the priority of the tasks in order is: Avoiding obstacles, moving to the destination, and maintaining the swarm. Assume that the obstacles are static and are known then the speed vector of each robot based on the null-space behavioral control technique [36] is calculated according to Figure 4.  The speed of the robot (i) is determined as follows:

Determining the Speed Component Avoiding Obstacles
where v o , v g , v s are the speed vectors performing the tasks: Avoiding obstacles, moving to the destination and maintaining the swarm. N o , N og are the projection matrixes according to the priority of the tasks.

Determining the Speed Component Avoiding Obstacles
Assume that in the working environment of the swarm the robot has M obstructions, σ o ∈ R is the actual distance between the individual robot (i) and the obstacle (m): The purpose of the speed component avoiding obstacle is that if the obstacle lies in the moving way, the robot must be kept away from the obstacle at a safe distance σ o,d = σ * o , if the obstacle is outside the safe area of the robot, the obstacle does not affect the movement speed of the robot. So, the movement speed of the robot depends on the distance between the robot and the obstacle.
The Jacobi Matrix J o ∈ R M×n shows the movement speed of the robot avoiding obstacles: The Matrix inverse of J o : The projection matrix of J o : where I n is the unit matrix. The speed component avoiding the obstacle is defined as follows: where k vo is a negative coefficient, o is the error between the actual distance and the desired distance from the robot to the obstacle.

Determining the Speed Component Moving to the Target
∈ R n×1 is the position of the target, σ g ∈ R is the actual distance between the robot (i) and the target, σ g is calculated according to the formula: The purpose of the speed component moving to the target is that the desired distance (σ * g ) is equal to 0: The Jacobi Matrix J g ∈ R 1×n : The Matrix inverse of J g : The projection matrix of J g : The speed component moving to the target (i) is rewritten as follows: where k vg is a positive coefficient, g is the error between the actual distance and the desired distance from the robot to the target:

Determining the Maintained-Swarm Speed Component
The purpose of the maintained-swarm speed component is keeping σ s = σ * s ∈ R. In this condition, the difference between the actual distance and the desired distance is: The Matrix inverse of J s : The projection matrix of J s : The maintained-swarm speed component of the individual robot (i) is defined as follows: Combining all the speed vectors of each robot when performing all three tasks based on the NSB method is shown in Figure 4: where: v i ∈ R n×1 , J og = J o J g , J og ∈ R (M+1)×n , N og = I n − J + og J og , N og ∈ R n×n .

The Algorithm of Swarm Robot Control for Performing Multiple-Task
The algorithm of swarm robot control for performing multiple-tasks includes the following steps:

•
The second step Calculating the distance between each robot (i) and each obstacle σ o , the distance between each robot and target, the distance between robot (i) and robot (j). Calculating the suction/thrust force f(σ s ) according to Equation (3), satisfying Condition (4).
• The third step • The fourth step The speed of the individual (i) at the step k (k = 0 ÷ K − 1) is determined by the formula: The distance moved of the robot (i) in a step time(∆t): The new position of the robot (i) after k + 1 steps: Repeat from the second step to the fourth step until all individuals converge at the target and after K calculation steps.

Simulation Results and Analysis
We ran the simulation in the two-dimensional coordinate system [500, 500]. The initial position of the robots, obstacles, and targets are random. The convergence process of the swarm robot without obstacles is shown in Figure 5.

Simulation Results and Analysis
We ran the simulation in the two-dimensional coordinate system [500, 500]. The initial position of the robots, obstacles, and targets are random. The convergence process of the swarm robot without obstacles is shown in Figure 5. R is the actual convergence radius of the swarm robot, R is also the distance from the nearest robot to the center of the swarm. The results of the calculation of the parameters in certain cases are presented in Table 1.  R is the actual convergence radius of the swarm robot, R is also the distance from the nearest robot to the center of the swarm. The results of the calculation of the parameters in certain cases are presented in Table 1. The results in Table 1 show that: • If the size of the swarm (N) increases, the convergence radius decreases; • If the safe distance (σ * s ) increases, the convergence radius increases; • The actual convergent radius (R) is always smaller than the calculated value (σ).
The simulation results are consistent with the theorem that the authors expressed above.
Run the swarm robot model with the obstacles, then the simulation results when the number of robots are changing and the priority coefficient is changing are shown in Figures 6 and 7. Figure 6 shows that all individual robots have moved to their destination and avoided obstacles along the way. After individual robots converge to the destination, they only move around the destination area and do not move away.
The simulation results when changing the priority coefficients k vo and k vg are shown in Figure 7. From the simulation results, we see:

•
If the coefficient k vg is larger, the individual movement to the target is faster.

•
If we want to increase the coefficient k vg but not let the robot collide with obstacles, we must reduce the coefficient k vo . This means, if k vg is more positive, k vo must be more negative.

•
If the number of obstacles (M) is bigger, the avoid-obstacle-coefficient (k vo ) must be more negative.
If the coefficient k vo is more negative, the ability of the robots to avoid obstacles is better, but the moving time to the destination will be longer. • The actual convergent radius (R) is always smaller than the calculated value (σ).
The simulation results are consistent with the theorem that the authors expressed above.
Run the swarm robot model with the obstacles, then the simulation results when the number of robots are changing and the priority coefficient is changing are shown in Figures 6 and 7.

Conclusions
In this paper, the authors applied both fuzzy logic to control the suction/thrust force between individuals in the swarm, and the null-space behavioral control technique to determine the total speed vector of each robot. The proposed solution is close to nature with high flexibility by selecting the input/output, defuzzifier, and the fuzzy rules. The simulation results coincide with the theories proposed by the authors. Compared with the previous methods, the advantage of our proposed method is that the object can be controlled easily without the requirement of knowing the mathematical equation. We controlled effectively a swarm robot without the object model equations. All individuals of the swarm move together to the destination without collision, and ensure the task of avoiding obstacles.
Author Contributions: Nga Le Thi Thuy proposed the initial idea. Thang Nguyen Trong and Nga Le Thi Thuy developed the research and analyzed the results together. Thang Nguyen Trong wrote the paper.

Conflicts of Interest:
The authors declare no conflict of interest.