# UAV Path Planning Model Based on R5 DOS Model Improved A-Star Algorithm
## 2 Materials and Methods
Define the connection line between the current position of the UAV and the target point \(V_{ut}\), the distance and the direction unit vector \(\overset{\rightarrow}{V}_{ut}(x_{vt},y_{vt},z_{vt})=\left(\frac{\left(x_{t}- x_{u}\right)}{d_{ut}},\frac{\left(y_{t}-y_{u}\right)}{d_{ut}},\frac{\left(z_{t}- z_{u}\right)}{d_{ut}}\right)\). To better screen the nodes, we calculate \(\overset{\rightarrow}{V}_{ui}\), the inner product N of the \(\overset{\rightarrow}{V}_{ui}\) unit vector, then we get Equation (5). \[ \begin{split} N=\overset{\rightarrow}{V}_{ui}\overset{ \rightarrow}{\bullet}\overset{\rightarrow}{V}_{ut}=x_{vi}x_{vl}+y_{vi}y_{vt} +z_{vi}z_{vl}\\ \left\{\begin{array}{l}N>0\quad\text{ keep the corresponding node}\\ N\leq 0\quad\text{remove the corresponding node}\end{array}\right.\end{split}  \tag{5}\]  
If \(N>0\), the corresponding node of the inner product is retained. If \(N\leq 0\), the corresponding node is removed. In this way, we further screened a batch of jump points, as shown in Figure 6. The direction of the arrow is the vector from the target point to the UAV, bound by the plane. The yellow node is the reserved node and the gray node is the removed node. This article removes unnecessary nodes. Because the movement path of the A-star algorithm is not smooth enough and there are many inflection points, it is not conducive to the rotation and displacement of the UAV. Then, after filtering the hop point and determining the best movement path, we use the nearest neighbor interpolation method to smooth the path, which is more in line with the movement mode of the UAV, such as Equation (6). This reduces the difficulty of moving the UAV and improves the obstacle avoidance efficiency of the UAV. Figure 6: Node filtering conditions. \[\left\{ \begin{array}{l}y_{s}(i)=\frac{1}{2N+1}[y(i+N)+y(i+N-1)+\cdots+y(i-N)]\\ y_{s}(1)=y(1)\\ y_{s}(2)=\frac{[y(1)+y(2)+y(3)]}{3}\\ y_{s}(3)=\frac{[y(1)+y(2)+y(3)+y(4)+y(5)]}{5}\\ y_{s}(4)=\frac{[y(2)+y(3)+y(4)+y(5)+y(6)]}{5}\end{array} \right. \tag{6}\]  
### Improved A-Star Algorithm  
According to the definition of the previous sections, we give the final path planning algorithm based on the R5 DOS model. The pseudo code is shown in Algorithm 1. The flowchart of the improved algorithm is shown in Figure 7.  
Figure 7: Improved algorithm flow based on A-star algorithm and APFM. ```
1 algorithm A-start plus (start, n, goal)
2 if reachAroundGoal(start) \(\
eq\) goal then return makePath(start)
3\(open\leftarrow\)closestPoint(start)
4 closed \(\leftarrow\) 0
5 finale \(\leftarrow\) 0
6 while open \(\
eq\) 0 do
7 sort(open)
8 n \(\leftarrow\) open.pop( )
9 if reachAroundGoal(n) \(\
eq\) goal then return makePath(n)
10 Jump \(\text{bodys}\leftarrow\)expandFlexibleUnits(n)
11 end if
12 for all the Jump bodys do
13: if\(R(A,B,C)= \begin{pmatrix}0&0&0&1\\ 1&1&0&1\end{pmatrix} \)
14: neighbor.f \(\leftarrow\)\(\mathcal{O}\)
15 if\(R(A,B,C)= \begin{pmatrix}0&1&0&1\\ 1&1&0&1\end{pmatrix} \) then open \(\leftarrow\) neighbor
16 else closed \(\leftarrow\) neighbor
17 end if
18 closed \(\leftarrow\) n
19 if crossPath(n) and smoothPath(n) then
20 final \(\leftarrow\) closed
21 end if
22 end if
23 end for
24 end if
25 return 0
```  
**Algorithm 1****A-start plus**