Research on CGF Formation Maintenance and Obstacle Avoidance

. In order to solve the problem of CGF formation avoiding obstacles, avoiding collisions and reach the target point in the simulated battlefield environment, combined with the behaviour-based method, the following algorithm will be improved to control the CGF formation. In this paper, the motion of CGF formation is decomposed into moving to target, maintaining formation, avoiding obstacles, restoring formation, reaching target, and a linear feedback mechanism based on the relative position of leader and follower is introduced to prevent the occurrence of the team. The tangent obstacle avoidance algorithm evades obstacles. The simulation experiment applies the upper-layer behavioural reasoning to guide the structure of the underlying physical model, and the SOAR agent makes the choice of the state of the environment and the behaviour, and the underlying physical model implements the behaviour. The results show that the strategy can keep the CGF formation in the desired formation, avoid internal collisions while avoiding obstacles, and quickly restore the formation after reaching obstacles, reach the target location and achieve good results.


Introduction
The computer force generation technology can generate a certain autonomous and intelligent simulation entity in the virtual battlefield, and the program language controls its motion [1]. As the complexity of the battlefield environment continues to increase, the capabilities of combat personnel are increasingly demanding. The individual soldier's ability to perceive, make decisions, and learn is very limited. If a single force has the ability to cooperate, keep the formation in the team, and communicate with other CGF entities, it will help to complete complex tasks [2]. Therefore, it is necessary to study how the CGF entity team maintains the formation in the movement and avoids obstacles. Moreover, the Agent entity maintains the formation in motion with the following advantages: Compared with a single Agent, the Agent team has more ability to acquire more battlefield situations and environmental information; With a certain formation movement, it can enhance the defensive performance and have better ability to defend against external invasion to ensure its own security; It can speed up the completion of tasks, and multiple agents form different formations according to different environments, which greatly improves the operational efficiency.
There are many algorithms for maintaining the formation of mobile groups, such as Leader-Follower, behaviour-based and virtual structure methods [3][4][5]. The Leader-Follower algorithm selects an Agent entity in the CGF formation and uses it as the leader of the mobile group. The remaining Agent entities act as followers. By keeping the distance and direction angle error between the follower and the leader at the desired level, the CGF formation maintains a certain tactical formation and completes the control of the formation [6][7][8][9]. Based on the behavioural method, the motion of each agent entity is decomposed into moving toward the target, maintaining the formation, avoiding obstacles, so as to control the movement. The artificial potential field method applies the principle of potential field in physics to the formation control algorithm [10][11], and defines the potential field of the target point, obstacles, and other Agent entities in the team. Each agent entity moves in a comprehensive artificial potential field, continuously moves to the weakest point of potential energy, and finally reaches the target point, and realizes the obstacle avoidance function in motion [12][13][14].
Based on the above analysis, the advantage of the Leader-Follower algorithm is that the design of the controller is relatively simple, and the communication cooperation between the Agent entities is simplified [15]. The disadvantage of this method is that the entire manoeuvring process is too dependent on the leader, and there is no clear motion error feedback between the leader and the followers. If the leader suddenly accelerates because of the change of the trajectory while avoiding the obstacle, the other followers may lose the tracking target because they cannot keep up with the leader, and eventually the formation cannot be formed. And the leader is the core of the algorithm [16]. If it fails or encounters other unpredictable emergencies, it will cause the entire CGF formation to lose its original formation and the combat mission fails. In order to solve this problem, this paper combines the idea of behaviourbased method to improve the algorithm, and decomposes the whole motion process into the target motion, followup control, obstacle avoidance and so on, which reduces the dependence of the followers on the leader. Linear feedback is added to the Leader's controller to avoid the loss of Followers due to obstacle avoidance.

Decision mechanism based on SOAR reasoning
For the choice of entity behaviour, this paper introduces the logical reasoning engine SOAR to make the Agent respond in complex situations. The advantage of using this method is that the high-level reasoning can be separated from the underlying algorithm [17]. Only the algorithm design of the behaviour is needed, so that it has better expansion performance, and the efficient reasoning ability of SOAR ensures the real-time performance of the simulation.
SOAR is a logical reasoning tool consisting of three parts: the inference engine, the rule memory, and the work memory. As shown in Figure 1. The inference engine is responsible for creating states, selecting operators, matching rules, behavioural output, etc. Knowledge in the form of IF-THEN is stored in the rule memory. The working memory is responsible for storing short-term knowledge, such as intermediate calculations, intermediate operators, and so on. Among them, goals, operators and states are three important concepts. The goal is the desired result for the current situation. An operator is a kind of logical relationship. When the condition is reached, the state change of the result can be achieved by a certain calculation. State refers to the state in which internal variables are located.
The decision process of SOAR is shown in Figure 2. The situation input is the entrance of the perceptual information. The SOAR selects and applies the operator according to the knowledge in the rule memory, changes the internal state and completes the behaviour output, thereby changing the external environment. Based on the marching process of the Agent team and the SOAR decision-making framework, the Agent behaviour is divided into the following parts: forward to the target, formation maintenance, obstacle avoidance and collision avoidance. When the Agent does not form any formation, the system first forms a formation, and the Agent advances in the current formation; if an obstacle occurs, the obstacle avoidance behaviour is triggered; if the obstacle is large or dense, the formation switching behaviour is triggered. / / x In order to more clearly describe the relationship between the agents, this paper presents the CGF formation in matrix form. The current location of the Agent is expressed as: The current speed is expressed as: The control input is: The state space of i Agent is: .Then the equation of motion of the Agent is obtained as follows: In the formula, 0 is a zero matrix and I is an identity matrix. Consider the Lyapunov function: The control rate is: Then we can get: In the formula: d x is a constant, let p k be 1, then: In the formula, because d k is a positive number, V is positive and V  is negative, and the motion of the Agent is gradually stabilized.

Leader moves toward the goal
The Leader is responsible for moving toward the goal, and its speed direction is always along the direction of the Leader's connection with the target point. Leader's speed deviation from the target: x y is the leader position. Leader speed is:

Formation and maintenance
When the SOAR reasoning mechanism is output to form a formation, followers move toward the leader according to the control algorithm and form a certain formation. The expected position difference between i Agent and leader is: At some point, the actual position difference between i Agent and leader is: Then the formation error of i Agent during the movement is: By making the tracking error i E tend to zero, the CGF formation can be trended toward the desired formation. Select the controller as follows:

Analysis of Agent Tangent Avoidance Algorithm
During the movement, if the distance between the Agent and the obstacle is less than the previously set threshold, obstacle avoidance measures will be taken. The principle of the tangent obstacle avoidance algorithm is to make the Agent move along the inscribed line between the obstacles and avoid them, as shown in Figure 3. The physical meaning of each symbol and variable in the figure is shown in Table 1:  x y is the coordinate of the center of the obstacle, and: In order to ensure that the Agent can completely avoid obstacles, a small angle needs to be added during the deflection process to ensure that the Agent does not collide with the edge of the obstacle. Then the speed direction of the Agent deflection is: A linear feedback is added to the leader's controller due to the fact that the speed of the follower may change during the obstacle avoidance process. When follower slows down due to obstacle avoidance, the speed of the leader will change accordingly to prevent the phenomenon of falling behind. The control structure after adding linear feedback is shown in Figure 4: The linear feedback information is:

Simulation experiment and verification
Set the initial speed of the virtual pilot to 40, and the expected angle difference is 2 / 3 π , The change of the follower1's speed is shown in Figure 5. Figure 6 shows the difference in the angle of movement between the leader and the follower during the tracking process. It can be seen that the follower first speeds up to the leader to keep up with the leader, and then gradually decelerates after reaching the desired distance. The direction of motion turns to the target point, and the speed approaches the leader until it is consistent with the leader. Figure 7 is a trajectory change diagram of the leader and the follower1. It can be seen that the tracking control between the agents is realized, and the formation and control of the formation are guaranteed.  Taking the triangle formation as an example, four points are randomly generated in the coordinate range of 500×500, and an obstacle is established as the centre of the circle, and the radius is randomly selected in the range of [20,150]. According to the simulation results, the Agent can avoid obstacles in time and quickly return to the specified formation to ensure the controllability and security of the formation.

Conclusion
In this paper, the existing follower algorithm is combined with the behaviour based method to optimize, the SOAR reasoning mechanism is used for environment perception and behaviour selection, and then the linear feedback mechanism based on the relative position of leader and follower is introduced. Finally, the tangential obstacle avoidance method is used to avoid obstacles. In this paper, the complex formation control problem is transformed into the trailing path of the leader and the tracking of the leader to the leader, which greatly simplifies the complexity of the problem. The simulation results show that the method can effectively make the CGF formation avoid obstacles and expect the formation to reach the target point, which has achieved ideal results.