# Motion Planning in UAV-Aided Data Collection with Dynamic Jamming
## 3 Global Replanning Based on CFC
### Replanning  
Based on the previously presented conclusions regarding the initialization path, we propose an SCA-based solution method for the convex optimization problem P1. The method approximates the optimal solution of the original problem P0 one by one through good initialization values and an iterative method based on Taylor expansions. The specific steps are shown in Algorithm 4. First, we initialize the state of the UAV and mission  
Figure 4: CFC initial path correction for obstacle avoidance. settings. Subsequently, we generate the communication corridor path and safe flight path for obstacle avoidance as the initial values to solve the optimization problem P1 according to the mission requirements. Good initial values enable the iteration-based SCA algorithm to converge quickly and obtain a local solution. However, in the actual mission environment, the disturbance sources and obstacles may change dynamically, and the path determined at one point in time is not applicable to the whole flight process. For this reason, we propose a planning algorithm based on replanning in which the UAV plans a new trajectory at a certain frequency. The specific process is shown in Algorithm 5. ```
1:Initialization:
2: Set the number of iterations \(r=0\). 3: Set the initial state of the UAV, position, speed, acceleration, etc. 4: Set the minimum required amounts of the communication bandwidth \(B\) and data \(Q_{th}\). Calculate the maximum communication distance \(d_{k}^{\max}\) and maximum communication rate \(r_{th}\) in accordance with the transmission system. 5: Generate a CFC that satisfies the data collection conditions with Algorithm 1. 6: Generate the initial CFC-based path with Algorithm 2. 7: Generate an obstacle avoidance path based on the initial CFC path for a safe flight with Algorithm 3. 8: Initialize \(p^{r}[n]\), \(\kappa_{k}^{r}[n]\), \(\varepsilon_{k}^{r}[n]\), \(\lambda_{i,m}^{r}[n]\), etc. with the path \(\mathbf{p}_{iniOA}\) generated by Algorithm 3, for \(n=1,\cdot\cdot\cdot,N\). 9:Repeat
10: Solve the problem (P1) by CVX and acquire the optimal solutionsn \(p^{*}[n]\), \(\kappa_{k}^{*}[n]\), \(\varepsilon_{k}^{n}[n]\) and \(\lambda_{i,m}^{*}\)
11: Update the optimization variables and slack variables at the \(r\)-th iteration following:
12: \(w^{r+1}[n]=w^{*}[n]\);
13: \(\kappa_{k}^{r+1}[n]=\kappa_{k}^{*}[n]\);
14: \(\varepsilon_{k}^{r+1}[n]=\varepsilon_{k}^{*}[n]\);
15: \(\lambda_{i,m}^{r+1}[n]=\lambda_{i,m}^{*}[n]\);
16: Update \(r=r+1\)
17:Until some termination conditions are met
```  
**Algorithm 5**Receding horizon planning. ```
1:Initialization: Set the minimum communication bandwidth \(B\) and data amount \(Q_{th}\). Calculate the minimum communication rate \(r_{th}\) and maximum communication distance \(d_{k}^{\max}\) in accordance with the transmission system, maximum UAV speed \(v_{max}\), maximum acceleration \(a_{max}\), maximum flight height \(H_{max}\), start position \(p_{0}\), and end position. And let init state \(s_{UAV}=[p_{0},0,0]\). 2:While:\(\|p_{uav}-p_{N}\|\leqslant\zeta\)do
3: Update the UAV states
4: Solving for global paths with Algorithm 5
5: Select a section of path points for B-spline smoothing
6:End
```  
**Algorithm 6**SCA-based trajectory planning method for (P1)  
To obtain a more suitable trajectory for the flight control module, we used B-splines to smooth the path in Algorithm 5. \(N_{Q}\) path points were chosen as control points for the homogeneous B-spline curve according to the set replanning frequency, which is uniquely identified via its \(p_{b}\), \(N_{Q}\) control points \(\{Q_{1},Q_{2},\ldots,Q_{N_{Q}}\}\) and a knot vector \(\{t_{1},t_{2},\ldots,t_{M_{Q}}\}\), where \(M_{Q}=N_{Q}+p_{b}\). To simplify and improve the efficiency of the trajectory assessment, the B-spline employed in our approach is homogeneous, which implies that each knot has the same time interval \(\delta\) between it and its predecessor. We normalize \(t\) as follows: \(s(t)=(t-t_{m})/\delta\).