# Coverage Path Planning with Semantic Segmentation for UAV in PV Plants
## 2 Materials and Methods
### 2D Coverage Path Planning Method in the GUI Interface
#### 2.3.1 Metrics  
The metrics evaluate the performance of the three CPP methods. Such assessment can be performed by considering five commonly used metrics to evaluate the effectiveness of the proposed CPP methods both theoretically and in simulation (dynamically) [7; 41; 43; 62]. These five metrics are covered path length, flight time, energy consumption, redundancy of points traveled, and percentage of coverage of the total area. Each of these metrics is described below.  
Figure 4: (**a**) Wavefront distance transforms for the selection of the initial position (I) and final position (F). (**b**) Coverage path generated using the wavefront distance transforms with the selection of the initial position (I).  
Figure 3: (**a**) Approximate cell decomposition in grids, and sub grids. (**b**), coverage path generated with the GBSTC method.  
The \(L_{ct}\) metric (covered path length) is the length of the entire path covered by the UAV from the initial to the final point. For a trajectory in a 2D plane composed of \(n\) points, assuming the initial point as \((x_{1},f(x_{1}))\) and the end point as \((x_{n},f(x_{n}))\), the \(L_{ct}\) can be computed as shown in Equation (1):  
\[L_{ct}=\sum_{i=1}^{n-1}\sqrt{(x_{i}+1-x_{i})^{2}+(f(x_{1}+1)-f(x_{i}))^{2}} \tag{1}\]  
where \((x_{i},f(x_{i}))\), in which \(i=1,2,\ldots,n\), representing all the \(n\) points of the UAV flight path in 2D coordinates. More details can be found in [87].  
The flight time metric of the PX4 SITL Gazebo model is the time required to travel the total flight path (takeoff, path travel, and landing) with a dynamic speed that considers the inertia and the variation in speed due to UAV turns angles. These data are collected through sensors in the Gazebo plugins [88].  
The redundancy of points traveled, \(R_{\%}\), corresponds to the number of points that are visited more than once from the total number of points that the path contains, Equation (2).  
\[R_{\%}=\frac{P_{pc}}{P_{vmo}} \tag{2}\]  
where \(P_{pc}\), and \(P_{vmo}\) correspond to the number of points the trajectory contains, and the number of points visited more than once.  
The percentage of coverage of the total area, \(C_{\%}\), measures the number of effectively covered points within the total number thereof by the points the area to be covered contains, given by Equation (3).  
\[C_{\%}=\frac{P_{v}}{P_{T}} \tag{3}\]  
where \(P_{v}\), and \(P_{T}\) correspond, respectively, to the total number of points visited and the total number of points in the area.  
Moreover, the number of maneuvers metric, which is the number of turning maneuvers the UAV performs on a path, is often used as the main performance metric in coverage [89; 90].  
The energy consumption metric is computed from the voltage and current data from the power module of the PX4 SITL model [91]. Its value depends on parameters, such as the CPP width between lines and the speed and the height of the UAV at the time of implementing the CPP, which were configured in the interface and were simulated in Gazebo.  
To validate the results of the methods described above, the BECD, GBSTC, and GBWC methods were implemented in two UAVs, simulated in Gazebo, and their performances were assessed by the metrics presented above [39]. The next section describes the results and compares the models in detail.