## 4 Indoor Testing Area
### Coverage Path Planning  
This section presents the implemented CPP algorithm. CPP is another challenging problem for UAVs [46; 47; 48]. The UAV aims to track the specific points defined by using the CPP method.  
In Figure 10, the boundaries, starting point, and the specific reference of the CPP lines are shown and coloured yellow, black, and turquoise, respectively. This is because the UAV has a task: reaching the specific points, which are the endpoints of the path segments. The following relation is used:  
\[d=w.(1-v). \tag{15}\]  
The shape, length, and direction of the path constructed by the CPP algorithm depend on \(d\), \(w\), and \(l_{s}\) values, and these correspond to the distance among rows, the half of the camera footprint, and the width of the original polygon, which is swept, respectively, and the percentage of vertical overlap between the width of the camera footprints on consecutive rows are denoted by \(v\) and with a total number \(n\) of turns equal to  
\[n=\begin{cases}2.\lceil z/d\rceil&\text{if }\left(z\bmod d\right)\ \leq w/2,\\ 2.\big{(}\lceil z/d\rceil+1\big{)}&\text{if }\left(z\bmod d\right)\ >w/2.\end{cases} \tag{16}\]  
The total number of turns \(n\) resulting from the CPP algorithm is given in Equation (16), and this algorithm aims to minimise \(n\) to some degree, as it can be seen that this number depends on the \(z\) value, which is a function of the polygon width that is \(z=l_{s}-w/2\). Therefore, the direction in which the polygon width is defined determines the value of \(n\).  
Figure 10: Example of coverage path planning.  
If the gap between the last row of the created path and the vertex or the edge of the original polygon is greater than half of the camera footprint \(w\), then an extra row is added to the end of the path to reduce the gap as mentioned earlier; therefore, the distance between the last row and the original polygon might be less than \(w/2\). In Figure 11, the difference between the distances from the border of the polygon to the initial row and the last row of the CPP path is an example of this case. The optimal line sweep direction and the path are determined by the following algorithm given in Algorithm 1[46; 47].  
**Step 1:** (Farthest vertex \(v\) from the edge \(e\))  
For each edge, find the farthest vertex with respect to Euclidean distance and keep this (\(e\), \(v\)) pair and the calculated distance value.  
**Step 2:** (Minimum distance pair (\(e\),\(v\)))  
Compare the distance values and find the (\(e\), \(v\)) pair which gives the minimum distance value.  
**Step 3:** (Orthogonal direction vector)  
The optimal line-swept direction is the vector that is orthogonal to the edge from the (\(e\), \(v\)) pair found in Step 2, and the rows constructed by the CPP algorithm will be parallel to this edge \(e\).  
**Step 4:** (Path construction)  
The path is defined by the way points that are connected by line segments. These way points are placed in such a way that the line segments connecting them are parallel to the edge on which the polygon width is defined and the distance between a way point and the border of the polygon satisfies the camera footprint requirements.  
The CPP algorithm is employed in the testing area offline as shown in Figure 11. After reference-point generation by the CPP algorithm, all the controllers implemented in this study are tested over the area.  
In the following section, the training and the testing results of the compared controllers are given, and it is shown that the best performance results are obtained by the IT2-FPID controller.