UAV Automation Control System Based on an Intelligent Sensor Network

With the widespread use of UAVs, it is gradually di ﬃ cult for single UAV to meet the needs of increasingly complex scenarios. At the same time, the problems of low autonomy and high dependence on control stations in central UAV cluster networks are gradually highlighted. In this paper, we analyze the theoretical conditions of network topology establishment and network connectivity, design a series of UAV distributed cluster automation control algorithm frameworks, and achieve certain research results, taking the distributed clusters of ﬂ ight self-organizing networks as the background and using mathematical tools such as algebraic graph theory and random geometry to build a vibration sensor array model based on multiple intelligent sensor management. Based on this, a distributed connectivity maintenance algorithm based on the importance of nodes is designed to realize the “ self-healing ” of the ﬂ ight ’ s self-organizing network. This study also improves the Mavlink ﬂ ight control communication protocol customization and Zigbee wireless networking mode design to solve the UAV swarm communication link collision problem. Compared with the existing distributed spectrum estimation-based node importance algorithm, the proposed algorithm further analyzes the topological changes caused by the removal of associated edges by failed nodes and the reconstruction of new associated edges between neighboring nodes, so that the theoretical results are closer to the actual topological dynamics of the ﬂ ight self-organizing network.


Introduction
With the continuous advancement of integrated chips, sensors, and hardware technologies and algorithms such as communication and automation control, UAVs are being used more and more widely in military, commercial, and civilian applications. Despite the rapid development of the UAV industry, UAVs also face a variety of problems in the application process. For example, in more complex and changing application scenarios, the limitations of single UAVs in performing tasks are gradually highlighted. In addition, once the UAV breaks down, it is difficult to continue the mission [1]. Moreover, due to the constraints of range, payload, and sensing capabilities, single UAVs are often unable to complete mission objectives such as data collection, area coverage, and even cargo transportation promptly. However, UAV clusters composed of multiple UAVs can solve these problems well. To make UAV clusters complete their tasks efficiently and reliably, their cooperative network control problem has been a hot research topic in academia. At present, the control strategies of UAV clusters are mainly divided into two types, namely, central cooperative control and distributed cooperative control [2]. The central cooperative control is more suitable for UAV cluster formation with fixed formation; while the distributed control is more suitable for formation-less missions with higher autonomy. The former is simpler in control implementation and can be used for formation-controlled flight shows, while the latter is more flexible in cluster formation and thus more autonomous in the face of complex missions [3]. In distributed UAV cluster collaboration, UAVs establish a flight selforganizing network by establishing communication links with neighboring nodes within communication range, thus eliminating the need for real-time control of all UAVs by ground control centers. Instead, the UAVs within the cluster use the information from the nearest neighbor nodes to adaptively adjust their motion state to achieve higher autonomy and flexibility, which can be applied to more complex terrain environments and mission requirements [4].
In this paper, we study the problems of motion planning, topology generation, and connectivity maintenance of UAV clusters in the process of consistent convergence from the three aspects of self-configuration, self-optimization, and self-healing of self-organized networks. First of all, we take the small quadrotor UAV as the research object, combine it with the smart sensor network deployment, and design the position and attitude automatic control system to address the problem that the PID control algorithm ignores the coupling between each channel and the interference problem brought by the internal when designing the small disturbance equation, and also the problem that the flight stability and maneuverability decrease when facing the complex disturbance by strong wind interference. Secondly, considering that the ADRC controller parameters are numerous and difficult to be adjusted manually, this paper designs an adaptive particle swarm algorithm to solve the problem of single inertia weight selection and accelerate the optimization speed, and applies it to the optimization of the attitude controller of quadrotor UAV. Although the expansive state observer is theoretically capable of accurately estimating the total disturbance sum of the system and compensating the control system by feedforward, thus equivalently converting the controlled system into an integrator series system. However, the disturbances estimated by the observer are often lagged in practical applications due to sensor measurement noise and other unknown factors. Therefore, this paper adopts an offline approach to filter the dilated observer data collected from the actual UAV flight by adding a time-delay-free Butterworth filter. Finally, a physical platform is built for trajectory tracking and fixed-point hovering experiments to verify the correctness of the designed controller; and a set of indoor flight comparison experiments are designed to further verify the anti-interference capability and robustness of the designed controller.

Related Work
With the development of control theory, sensor technology, and microelectronics, the vehicle has been developed in the direction of lightweight and miniaturization, and the breakthrough from "manned" to unmanned aircraft has been achieved after decades of research. In the literature [5], a loosely coupled multisensor fusion technique is used to fuse the semidirect method of visual odometry to calculate the positional and IMU outputs without scale, and the control algorithm of the miniature quadrotor can run in real time on an embedded system with guaranteed accuracy and robustness. In the literature [6], a complete navigation scheme is designed for AR. Drone quadrotor UAV is based on the robotic ROS operating system. PTAM based on FAST features is used to give the positional estimation, and then, the sensor data is fused using EKF to obtain the positional results with scaling. Maddikunta [7] developed control algorithms and navigation and obstacle avoidance techniques which are combined to develop a flight control platform independently, and the designed controller is applied to the flight control system of the UAV, which not only improves the system robustness but also improves the accuracy of the attitude angle control of the UAV. In the literature [8], the trained ELM network was considered as a direct inverse controller, and its output and the controller output were summed to act on the UAV to improve the robustness of the system. Sungheetha [9] starts from the analytical modeling of dynamic systems to accomplish the accurate control of UAVs. The lab not only realizes tasks such as information acquisition of multidimensional environment using sensors and reconstruction of unknown flight environment information but also conducts experiments such as UAV cluster formation and fault diagnosis. In the literature [10], a vision-based quadrotor navigation method uses two recovery methods to solve the problem of failure of the visual odometry calculation method according to the quadrotor flight scenario, which enables visual navigation in outdoor environments and stable flight without relying on GPS. The inverse controller designed in the literature [11] can solve the uncertainty and nonlinearity problems in the mathematical modeling of the quadrotor, and the designed inverse controller can control the attitude angle precisely. Deng [12] applies the idea of linearization to nonlinear systems and linearizes the extended Kalman filter theory applicable to nonlinearities; although this method has approximation errors when linearizing, it is of great research value in attitude estimation. Fatemidokht [13] proposed a combination of the conjugate gradient method and complementary filtering for multisensor data fusion, which has a better performance when the attitude changes drastically, but the problem of iterative computational effort arises during the calculation. Skorobogatov [14] proposed a Kalman filter algorithm design and a dual-gain PD control algorithm for multisensor data fusion and compensation using Kalman filtering in short and long periods, respectively, but the results of the controller leave room for improvement. The literature [15] used a complementary filtering algorithm to combine the advantages of accelerometer, magnetometer, and gyroscope each in the frequency domain and fused the data from these sensors to estimate the attitude angle, which can handle the sensor noise well in the frequency domain and achieve the accurate estimation of the attitude angle. Qadir [16] combined accelerometer and gyroscope for attitude estimation by the established three-degree-of-freedom system model, and the algorithm used was the Kalman filter algorithm, and it was verified that the method could solve the error and drift problem when the quadrotor UAV vibrated, but the final experimental results were not very obvious because the inertial devices of the experimental platform were installed firmly and the amplitude of vibration was not very large. The literature [17] used the traceless Kalman filter (UKF) to process the sensor data and perform attitude measurements under static and dynamic and eliminated the errors brought in by the motion acceleration by 2 Journal of Sensors adjusting the noise covariance array of UKF in the dynamic measurement; although this method can avoid the interference of motion acceleration and improve the dynamic accuracy in the short term, it is difficult to get a stable attitude if the carrier is doing maneuvering motion for a long time angle. Dawson [18] used the rotation matrix Kalman filter for attitude estimation, which effectively solved the problem of large errors in the estimated attitude angles when there is interference from motion acceleration, and tested both in dynamic and static, and verified that the accuracy of the estimated traverse and pitch angles of this method has been greatly improved, although the accuracy improvement of yaw angle is not as large, but also has some improvement.

Wireless Sensor Network Positioning Technology Design.
When using WSN (wireless sensor networks) to obtain monitoring data, the observer must rely on the specific location information of the node to know "where, when, and what happened." Location-based service (LBS) is a typical feature of WSN applications, and most WSN sensing data is location-aware. Location is the basis of WSN data sensing, routing protocols, namespaces, network topology adaptive configuration, and load balancing applications. WSN localization principle is usually based on a limited number of but computationally powerful, sufficient power and the known location of the anchor node combined with the anchor node and the unknown node range information or network topology relationship through a specific positioning algorithm to calculate or estimate the location of the unknown node in the wireless sensor network. The WSN localization principle is shown in Figure 1.
Wireless sensor network nodes can be divided into common nodes and anchor nodes according to their functions [19].
(1) Ordinary nodes: Ordinary nodes are nodes to be located in wireless sensor networks for sensing, and transmitting data and unknown locations, also known as target nodes, blind nodes, or unknown nodes, most nodes in wireless sensor networks are ordinary nodes. Ordinary sensor nodes are energy limited and usually cannot be charged, and some nodes are mobile enough. Need to refer to the anchor node with some kind of positioning algorithm in the upper computer for positioning (2) Anchor node: also known as reference node or beacon node. It is a node whose location is known and can be manually deployed at a specified location or obtained by GPS in advance. The advantages of GPS are that it does not require a lot of manual operation, and the anchor node can be moved after deployment, but the disadvantages are high cost, large volume, energy consumption, and poor positioning effect in nonvisual range environments such as indoor, underwater, or basement. Ordinary nodes can be considered as quasi-anchor nodes to participate in the positioning of other nodes after positioning The so-called node localization is a certain method and technique to obtain the absolute or relative position of unknown nodes in the network over. In the case that there are already a certain number of anchor nodes in the wireless sensor network, one or several localization techniques are used to estimate the localization of the unknown nodes. In the actual flight process, the sensors on the quadrotor UAV need to continuously collect and transmit data, and the internal control algorithm also needs to carry out realtime data solving and issue corresponding control commands, so the requirements for real time are relatively high; however, the APSO algorithm uses an iterative update method for the controller parameters, which takes a long time and cannot complete the online UAV controller optimization. When there are no anchor nodes in the network at all, only the relative position information of the nodes can be obtained. In this paper, the localization problems referred to are all about localization in the twodimensional case. The basic principle of the localization algorithm is to directly or indirectly measure the orientation, distance, or other connectivity information between the nodes of the wireless sensor network, and then calculate the position data of all nodes in the wireless sensor network from this information, and finally correct the obtained position data to reduce the localization error and improve the localization accuracy.
Assume a wireless sensor network with n nodes, consisting of m >0 anchor nodes (numbered 1-m) and n-m (numbered m + 1 − n) unknown nodes, where denotes the location of the m anchor nodes, and then the localization problem can be represented by the following relational equation.
The localization problem can be described as keeping the transformation relation f m in a backward and forward correspondence. The transformation relation f m can be represented as a coordinate diagram or matrix equation in a specific localization algorithm.
As shown in Figure 2, black points denote the anchor node, and red points denote the unknown node. In the network nodes, the anchor nodes occupy a small proportion, and they can be used as reference nodes in the localization process.

Journal of Sensors
Unknown nodes communicate with neighboring unknown nodes or anchor nodes to estimate their positions by localization algorithms in the following three phases.
(1) Distance measurement phase. Measure the angle or distance information of the unknown node relative to the anchor node. In the first stage, the collected information is shared among nodes to determine the distance or angle between each node and the anchor node, which is used to calculate the position of the node in the second stage. No complex compu-tation is required in this phase, so this phase is implemented by communication. The first stage is ignored in the localization algorithm that does not require ranging [20]. The measurement information between neighboring nodes is obtained from each other by physical measurements or estimated from each other by multihop communication within the network. Typically, the measurement information is one or more of the received signal strength indication, distance, angle, and connectivity. Ranging techniques are usually TOA, AOA, TDOA, and RSSI (2) Positioning phase. The unknown node position is calculated based on the position information of the anchor node and the distance (or angle) information from the unknown node to the anchor node in the first stage (3) Positioning optimization stage. This stage is based on the results of the second stage to calculate the position improvement of the node. Using the distance relationship between the unknown node and the neighboring nodes, the unknown node first broadcasts its estimated position and receives the position and the corresponding distance estimation information from the neighboring nodes and then reexecutes the positioning process in the second stage to determine the position of the node. Generally, the distance limit of neighboring nodes can make the new estimated position closer to the actual position of the node. After several iterations, the position update becomes smaller, the refinement  Based on the number of localization targets, it can be divided into single-target localization and multitarget localization. Single-target localization specifies that the bit algorithm is executed for one target at a time, and the localization information used by the algorithm can only be used for the localization of one target. If multiple targets need to be localized, the localization algorithm needs to be repeated several times, which is much less efficient than multitarget localization algorithms [21]. Multitarget localization is often performed in parallel using the information between multiple unknown nodes and anchor nodes in the network. The algorithm is more complex, but the localization is more efficient and can be achieved when the ranging information is incomplete.
According to whether the unknown nodes and anchor nodes have movement properties, they can be classified into static positioning and dynamic positioning. Static positioning means that the nodes and anchor nodes in the wireless sensor network cannot move, and the actual coordinate positions of the nodes will not change once the initial deployment is completed; i.e., the network topology of the wireless sensor network does not change over time. Dynamic positioning refers to the nodes and anchor nodes in a mobile wireless sensor network that is partially or fully mobile capable; in the actual experiment, the optimized controller is applied to the built UAV platform by using the offline optimization method to conduct flight experiments. As node movement brings changes in network topology over time to localization, network parameters also change over time, and static localization algorithms cannot simply be repeatedly applied to localize moving targets [22]. In contrast, the dynamic localization algorithm represented by the Monte Carlo localization algorithm can locate with high accuracy according to the mobility of nodes. The intelligent sensing network-based UAV automation control system designed in this paper adopts a multitarget dynamic localization method.

UAV Topology Control Algorithm Based on
Multiobjective Dynamic Localization Intelligent Sensing Network. In this paper, a distributed topology control algorithm is designed to enable each node to maintain the necessary neighboring node links and remove the redundant communication links. Due to the limited communication resources and the nonexistence of facilities such as centralized base stations for communication resource allocation, there is a limit to the number of communication links that can be maintained by each UAV. In addition, as the number of neighboring UAVs within the communication range increases, reducing the nonessential neighboring node links can effectively reduce the communication and computational overhead of the UAVs. Therefore, the designed topology control protocol must enable the generated network graph to have a finite upper bound on the vertex degree; i.e., the maximum number of edges of any node must be less than a certain constant value [23]. In addition, to satisfy the distributed property, the designed protocol should enable each node to utilize the information obtained from its neigh-boring nodes within one hop. At the same time, the generated graph should satisfy the symmetry, because, in an asymmetric topology, it is more likely to generate clusters that fail to converge.
Compared with traditional topology control mechanisms such as fully connected, W recently, or AAT, the BAT mechanism designed in this paper inherently follows the principles of distribution as well as symmetry. Therefore, the generated network structure is scalable as well as robust as the number of UAVs in the UAV cluster increases. In addition, by modeling the communication links between UAVs as bidirectional links, the symmetry of the BAT rules helps to avoid unnecessary troubles caused by hidden terminals, due to unidirectional links. To achieve the three goals of collision avoidance, distance maintenance between neighboring nodes and speed convergence. In this paper, the following fully distributed motion control mechanism is designed.
The motion control term consists of two components, namely, a distance control term K and a velocity control term L, whose vector sum is used to generate the corresponding acceleration of the UAV. Its specific form is as follows.
The number of edges that can be created by each node increases, and thus, the total number of edges in the whole network graph increases. On the one hand, this leads to an increase in the number of neighboring nodes satisfying the BAT condition and thus makes it more difficult for the whole UAV cluster to converge to a consistent state. On the other hand, as the number of edges in the generated network topology increases, the algebraic connectivity of the corresponding network graph increases, making the network converge to a globally consistent rate faster. Meanwhile, the increase in reference information from neighboring nodes makes it easier for nodes to achieve global speed consistency. The quadrotor UAS is nonlinear, strongly coupled, and underdriven, and its translational motion is influenced by the rotational motion, so how to design an effective flight controller becomes the key to the research. The classical PID control algorithm has the advantages of simple implementation, easy parameter tuning, and strong robustness, which can usually meet the UAV control requirements, but when facing complex disturbances such as strong wind interference and load changes, the vehicle control effect will become poor.
Although the expansive state observer is theoretically capable of accurately estimating the total disturbance sum of the system and compensating the control system by feedforward, thus equivalently converting the controlled system into an integrator series system [24]. However, the disturbances estimated by the observer are often lagged in practical applications due to sensor measurement noise and other unknown factors. Therefore, this paper adopts an offline approach to filter the dilated observer data collected from the actual UAV flight by adding a time-delay-free Butterworth filter.

Journal of Sensors
To achieve accurate control of the UAV, firstly, the data collected by the sensors are preprocessed, and the UAV flight information is obtained by solving the UAV attitude and position data, and then, the corresponding target parameters are obtained according to the different planning paths, and the calculation of the motor control amount is completed by the position and attitude control algorithms. By performing the actual trajectory tracking and fixed-point hovering flight, it is obvious from the experimental results that the quadrotor UAV can achieve stable flight, which verifies that the designed controller is correct. In this experiment, the position and attitude decoding and sensor fusion algorithms are not studied indepth, and only the controller design is improved. The flow chart of laser data acquisition is shown in Figure 3.
Two new control algorithm processes are created to overwrite the previous original attitude and position control algorithms, subscribe to the relevant messages using the interprocess communication mechanism for MORB, calculate the corresponding control quantities, obtain the given values of the motor by solving the inverse of Equation (3), and distribute the messages. The attitude controller is used as an example for illustration.
(1) Call the px4_task_spawn_cmd function to create a new posture control process (2) Subscribe to the attitude information and position control output obtained from the attitude solution through the orb_subscribe function The expected posture angle of the news and other related news.
(3) Read all subscription data by the orb_copy function (4) Calculate the appropriate amount of control and publish it through the orb_publish function for other processes to subscribe to (5) Detects whether to end the loop The purpose of quadrotor UAV attitude estimation is to estimate the traverse angle, pitch angle, and yaw angle, and the high-precision attitude information is mainly using the data from MARG sensors, according to the contents of Chapter 2 and Chapter 3, and it is known that the dynamic response of the three-axis gyroscope is faster and the measurement accuracy is high, but the integration error becomes larger with the gradual increase of time when the attitude measurement is performed for a long time, while the attitude angle measured by accelerometer and magnetometer. The so-called node localization is the process of obtaining the absolute or relative position of an unknown node in the network by certain methods and techniques. In the case where there are already a certain number of anchor nodes in the wireless sensor network, one or several localization techniques are used to estimate the location of the unknown nodes. When there are no anchor nodes in the network at all, only the relative position information of the nodes can be obtained. The gravity vector and geomagnetic vector of   Journal of Sensors the quadrotor UAV measured by accelerometer and magnetometer can also calculate the attitude angle without integration drift, and the accuracy of the attitude angle measured under the static is high, but the accuracy of the attitude angle measured under the dynamic will decrease.

UAV Swarm Automation Control Intermachine Communication Design
In the process of geese bionic flight of the UAV, the host needs to exchange information with each slave in the fleet, and the information transmitted through Zigbee must have a communication protocol with high transmission efficiency, consistent identification, and data reliability. The Mavlink communication protocol, known as the micro air vehicle chain communication protocol, is a small open-source communication protocol based on serial communication and follows the common public license agreement. The protocol is designed for small unmanned aerial vehicles based on the C language structure of the header file library, a total of more than 200 packet structures, which can better meet the requirements of the flight control system, and ensure the security and reliability of data transmission [25]. The protocol can be generally divided into three layers, from top to bottom, application layer, data link layer, and transmission layer. Only the UAV ground station has the above three complete protocol layers, while the interaircraft communication of the UAV swarm only retains the data link layer and transmission layer design to save the memory space of the total controller chip. Among them, the data link layer mainly consists of various Mavlink target functions, which are mainly responsible for verifying, decoding, and padding Mavlink protocol packets, and then sending the processed protocol packets to the bottom transmission layer. The main task of the transport layer is to send the packets processed by the data link layer through the Zigbee serial port, and at the same time, the data received by the serial port will be initially identified and sent to the data link layer for processing by the target function.
As can be seen from Figure 4, when the host system in the UAV swarm sends waypoint paths to other UAVs, it first selects the flight mode by modifying the MSG flag bit and then brings up the corresponding MSG function structure in the system library file and adds the starting data bit STX, the calculated protocol packet length LEN, the COMP indicating the sensor module, the specific waypoint information PAYLOAD, the check bit CRC, and the protocol packet sequence number SEQ after the MSG flag bit in order. The number of waypoints sent from the host system to the slave system is generally large, and the Mavlink protocol provides two modes of sending waypoints, guided and automatic. The guided mode has a simple control structure and is easy to implement for simple multiwaypoint tasks; the automatic mode encodes a larger number of tasks and requires a task script, which can be a set of waypoints or a very complex action such as taking off, rotating n times, and taking pictures. In this article, we take the execution of waypoint tasks in the guided mode as an example and introduce the implementation of the communication method in detail. First, send a mode switch command (command 14, packet 0) to the UAV with the specified number (0xFD), enter the selfstabilization mode, perform the unlock operation (command 41, packet 400), and then send the mode switch command again (command 14, packet 4) to switch to the guidance mode. In guidance mode, you can send a takeoff command (41 packets 21 commands), and then, you can send multiple fixed-point flight commands (41 packets 16 commands) to complete a waypoint mission. If there is no waypoint mission, you can switch the mode to hover (packet 14 command #5) and wait for a clear next command until you receive a command to switch back to guidance mode (packet 14 command #4) [26]. When the mission is completed, the landing command is sent (command 41 packets 22), fully realizing autonomous bionic flight without human intervention throughout.
The ground station no longer has a key position in the overall wireless communication link and is used only as a complementary secondary tracking means. It can monitor the UAV swarm and detect it in real time to ensure the proper flight of the group during a waypoint mission nearby.  The Mavlink communication at the ground station has three protocol layers: the application layer, the data link layer, and the transport layer. The application layer mainly receives input data from the user on the ground station control interface and then extracts and restores the Mavlink messages for display on the user's 2D graphic interface; the data link layer mainly identifies and verifies the data packets by calling the Mavlink structure in the system library file and then sends the processed data packets to the underlying transport layer interface. The transmission layer mainly sends the data packets processed by the structure function of the data link layer to the UAV side through the ZigBee wireless serial communication device, and will initially process the data received through the hardware device, and then transmit it to the data link layer and wait for processing.
The design uses the sliding mean filtering algorithm to process the raw data collected by GPS with a filtering factor of 5.5 consecutive sampled values which are regarded as a circular queue, and each time the newly collected data is put to the end of the queue, the data at the beginning of the original queue is thrown away (first-in-first-out principle), and then, the average of the 5 values of the current queue is output. The GPS module position is fixed, and several hundred sets of latitude and longitude data are repeatedly collected [27]. A comparison of the data before and after filtering shows that the drift range of the filtered data is significantly reduced, which proves that the filtering algorithm can greatly improve the stability of the system. After determining the structure of the GRU neural network based on the above pose estimation structure, the GRU neural network is trained with a different number of iterations and number of hidden layer units using the error back propagation training algorithm to update the weights and other parameters in the GRU neural network model, and then fit the nonlinear correspondence between the input and output data of the GRU neural network, and finally, make the GRU The GRU neural network gradually achieves convergence.
The training process of the GRU neural network is as follows: The normalized data of three-axis acceleration and three-axis magnetic field intensity are entered into the input layer of the GRU neural network, and then, they are passed to the implicit layer unit for the corresponding calculation, and after the processing is completed, they continue to be passed forward to the output layer, and the actual output value of GRU neural network is differenced from the desired output gravity vector and geomagnetic vector h. Then, it is transferred to the process of backward propagation of errors, and the calculated error values are returned layer by layer in the reverse direction of forwarding propagation, and the parameters such as weights of neurons in each layer are adjusted so that the errors are continuously reduced [28]. The ground station no longer has a key position in the overall wireless communication link and is used only as a complementary secondary tracking means. It can monitor the UAV swarm and detect it in real time to ensure the proper flight of the group during a waypoint mission nearby. The Mavlink communication at the ground station has three protocol layers: the application layer, the data link layer, and the transport layer. Then, a new round of propagation process is carried out again, and this is repeatedly iterated until the GRU neural network reaches the optimal value we expect, and finally, the learning process of the GRU neural network stops when the error value meets the condition requirements. After the training is completed, the number of implicit layer units, the number of iterations, and the learning rate of the GRU neural network with the smallest root mean square error of the calculated pose angle are selected, and then, a set of test sets are selected for testing under this parameter.

Experimental Verification and Conclusion
5.1. Algorithm Accuracy Verification. As shown in Figure 5, there is a linear relationship between the time to train the GRU neural network and the number of cells in the hidden layer, and the root mean square error of each attitude angle gradually decreases as the number of cells in the hidden layer increases, and when the number of cells in the hidden layer increases to 15, the GRU neural network algorithm fuses the attitude angles estimated by accelerometers and magnetometers to obtain the best performance, at which the root mean square error of the traverse, pitch, and yaw angles The root mean square error values of the traverse, pitch, and yaw angles are 1.926°, 2.088°, and 1.450°, respectively. However, when the number of cells in the hidden layer is greater than 15, the RMS error of attitude angle starts to increase gradually, and when the number of cells in the hidden layer increases to 21, the GRU neural network will show an overfitting phenomenon, resulting in a larger increase in the RMS error of attitude angle.
After the training of the GRU neural network, to further evaluate the overall performance of the attitude estimation algorithm based on GRU and accelerometer, and magnetometer, 3,000 sets of data from the original data collected by the quadrotor UAV experimental platform were selected as the test data set for the evaluation of the overall performance of the algorithm when the quadrotor UAV was in large-amplitude motion.
When testing the attitude estimation algorithm based on GRU and accelerometer and magnetometer using the test dataset, the number of neural units in the hidden layer of the GRU neural network is set to 15, the number of iterations is set to 7,000, and the learning rate is set to 0.001. During the test, the root mean square error value is still used to evaluate the overall performance of Gru. In the flight process of UAV, there is no gravitational acceleration, motion acceleration and fuselage shaking acceleration under ideal conditions. The results of the comparison between the cross-role, pitch, and yaw angles output by the GRU neural network algorithm and the reference real attitude angles under the test set are shown in Figure 6, where the root mean square error values of each attitude angle estimated by the algorithm under the test set are significantly reduced.
The analysis of Figures 5 and 6 shows that using GRU neural network algorithm to fuse accelerometer and magnetometer for attitude estimation is a feasible solution, but from the test results, when the amplitude of quadrotor UAV movement is relatively large, some data of the attitude 8 Journal of Sensors angle estimated by GRU neural network algorithm will deviate from the real attitude angle, and the deviation of yaw angle is the most obvious, which is because the accelerometer This is because the accelerometer is susceptible to vibration and has poor performance under dynamics. Although the attitude estimation algorithm based on GRU neural network and accelerometer and magnetometer has better performance in a static situation, in practical application, the flight state of quadrotor UAV cannot be kept constant all the time. In addition, the magnetometer itself has errors such as zero bias and nonorthogonality and is easily disturbed by the surrounding magnetic field. Therefore, the combination of accelerometer and magnetometer only for attitude estimation has a large error. To reduce the error caused by the body vibration, the gyroscope will be introduced in the next chapter, and the GRU neural network algorithm will be used to fuse it with the measured values of the accelerometer and magnetometer for attitude    Journal of Sensors estimation, to improve the dynamic accuracy of the attitude angle of the quadrotor UAV.

Practical Flight Verification.
In the actual flight process, the sensors on the quadrotor UAV need to continuously collect and transmit data, and the internal control algorithm also needs to carry out real-time data solving and issue corresponding control commands, so the requirements for real time are relatively high; however, the APSO algorithm uses an iterative update method for the controller parameters, which takes a long time and cannot complete the online UAV controller optimization. However, in the actual experiment, the optimized controller is applied to the built UAV platform by using the offline optimization method to conduct flight experiments. Firstly, the coordinate system is established through the calibration bar of Vicon, and the UAV is placed at the origin with the XY axis direction in line with the coordinate system. Then, set the flight altitude expectation value to 1 m, take the coordinate origin (0, 0) as the flight starting point, conduct the track point tracking, set (-0.5, -0.5,1), (0.5, -0.5,1), (0.5, 0.5,1), and (-0.5, 0.5,1) four-track points in turn, and hover at this point for 10s, and finally return to the first track point. The tracking capability of the control algorithm is tested by returning to the first track point, which forms a square with a side length of 1 m. The six degrees of freedom information of the UAV is captured by the motion capture system, as shown in Figure 7. Figure 8 is the attitude angle distribution diagram, from which we can see that the fluctuation range of the cross-roll angle is 0.03 rad, about 1.7 degrees; the fluctuation range of the pitch angle and yaw angle is 0.02 rad, about 1.5 degrees, and the control effect has no special change compared with the previous trajectory tracking results, and the control is relatively stable. The data of 2000 sampling points, selected every 20, constitute a discrete point data set consisting of 100 points; the radius of the green outer circle is 0.05 m; the radius of the blue inner circle is 0.03 m; and it can be found that all the data points fall within the radius of 0.05 m circles, and 73.46% of the points fall within the radius of 0.03 m circles. Combined with the position curve, it can be found that the quadrotor UAV achieves a relatively good hovering effect. By performing the actual trajectory tracking and fixed-point hovering flight, it is obvious from the experimental results that the quadrotor UAV can achieve stable flight, which verifies that the designed controller is correct. Compared with PD position control, the control of attitude angle using the optimized ADRC controller has higher accuracy and better robustness.

Conclusions
Based on a thorough theoretical study and analysis of the flight control characteristics of UAV swarms, this paper develops the main research content of this paper by combining multisensor fusion, sensor error compensation, timeseries signal processing, dynamic acceleration interference, and attitude information contained in optical flow sensors that are not fully utilized in attitude measurement. The atti-tude estimation algorithm using GRU neural network and accelerometer and magnetometer is investigated, and the core control algorithm to guarantee the stable operation of the flight control system is explored and designed, including sensor data processing algorithm, stand-alone system control algorithm, and goose formation control algorithm in three parts. The geese host flight path planning algorithm and slave geese the following strategy are designed to cooperate with the flock geese dynamic planning, forming a complete UAV flock dynamic planning scheme. And a large number of simulation and comparison experiments are conducted by MATLAB software to verify the feasibility of the above algorithms.
The research of flight characteristics analysis and control methods of UAVs involves many disciplines and fields such as mechanical structure, fluid dynamics, sensing technology research, artificial intelligence, and computer software development. Due to the short research time, this project has accumulated some technical experience, but there are still some problems from the practical application, which need to be explored and solved in future research. In future work, further analysis and research on multihost and dynamic host control methods are needed. Set permissions for UAVs in the fleet, and if the long aircraft is out of control, other UAVs with higher permissions will take over the task of the long aircraft, giving full play to the superiority of artificial intelligence.

Data Availability
The data used to support the findings of this study are included within the article.