## 3 Four-Dimensional Dynamic Cooperative Path Planning Algorithm
### Dynamic Priority RRT* Algorithm
Therefore, we designed a cost function that is able to meet the time cooperation constraints, namely the 4D cost function, to evaluate and optimize the tree structure constructed by the algorithm to ensure that the planning path can meet the 4D cooperation constraints. Unlike the classical RRT* algorithm, the 4D cost function no longer aims to optimize the shortest path but to optimize the length of the cooperative path. The 4D cost function of any UAV is defined as follows:

\[f_{\mathcal{T}_{i}}^{4D}(x)=\left|f_{\mathcal{T}_{i}}(x)-l_{co}^{i}\right| \tag{10}\]

where \(f_{\mathcal{T}_{i}}(x)=g_{\mathcal{T}_{i}}(x)+\lambda_{h}h(x)\). \(g_{\mathcal{T}_{i}}(x)\) represents the actual distance from the root node of tree \(\mathcal{T}_{i}\) to node \(x\), \(h(x)\) represents the estimated distance from node \(x\) to the goal of the UAV\({}_{i}\), and \(\lambda\in\mathcal{R}^{+}\) represents the coefficient. 2. The 4 DRRT* Algorithm Process

Functions 4 DRRT*, 4 DRRT*_rewire, and 4D_Extand in Algorithm 2 show the overall flow of the 4 DRRT* algorithm, taking UAV\({}_{i}\) as an example. After obtaining the sampling nodes in the current planning space through to the end node-guided offset sampling strategy, the algorithm enters the process of tree node expansion based on the 4D cost function guidance (i.e.,4D_Extand). Similar to classical RRT*, 4 DRRT* first calculates the expansion distance between the tree node x\({}_{\mathcal{T}}\) and the sample node x\({}_{rand}\). It then uses the constraints defined in Definition 1 (corresponding to UAV_free), Definition 3 (corresponding to obstacle_free), and Definition 4 (corresponding to Conflict_free) to determine the tree node x\({}_{\mathcal{T}}\). If the constraints are met, the 4D cost function is used to calculate the time cooperation cost. After all tree nodes are calculated, the tree node with the lowest cost for the expansion is selected. After obtaining the extended new node x\({}_{new}\) guided by the 4D cost function, a neighborhood centered on x\({}_{new}\) is built and the node in the tree structure within its range is found in order to form the set **X\({}_{near}\)**. Then, the optimization process of the neighborhood parent node is begun (i.e., 4 DRRT*_rewire is called for the first time). First, the constraint judgment is performed on the edge (x\({}_{new},x_{near}\)) composed of the new node x\({}_{new}\) and the node x\({}_{near}\) in the neighborhood. If the UAV performance constraints, environmental constraints, and spatial cooperation constraints in the 4D cooperation constraints are met, the cost of taking x\({}_{near}\) as the potential parent node of x\({}_{new}\) is calculated. After all the neighborhood nodes are calculated, the region node x\({}_{near}\) with the lowest cost is selected as the optimal parent node of x\({}_{new}\). Similarly, the 4 DRRT*_rewire function is called for the second time in order to complete the reconnection of the tree structure. The purpose of this call is to optimize the parent node of \(x_{near}\) by taking \(x_{new}\) as the potential parent node of all neighborhood nodes \(x_{near}\) to reduce the cost. When the new node \(x_{new}\) is extended to the terminal range of UAV\({}_{i}\), a potential 4D cooperative path \(\sigma_{i}(s_{i},g_{i})\) is obtained through the backtracking tree structure. If the deviation between the path length \(\text{Cost}_{\mathcal{T}}(s_{i},g_{i})\) of \(\sigma_{i}(s_{i},g_{i})\) and the cooperative path length is within the tolerance \(\epsilon\), the algorithm is terminated and outputs the 4D cooperative path with \(\sigma_{i}(s_{i},g_{i})\) as UAV\({}_{i}\). Otherwise, the tree structure continues to expand in order to reduce the 4D cost until the tolerance between \(\sigma_{i}(s_{i},g_{i})\) and the cooperative path length \(l_{co}\) is less than \(\epsilon\).