# Coverage Path Planning with Semantic Segmentation for UAV in PV Plants
## 2 Materials and Methods
### 2D Coverage Path Planning Method in the GUI Interface  
In previous studies of CPPs, there were many existing methods from which to select to solve the CPP problem. In this work, three methods based on CPP were selected, considering the following criteria: time of execution, ease of implementation, and more, which were used to cover the RoI. The methods were selected according to [38; 39]. The boustrophedon exact cellular decomposition (BECD), which was proposed by [84], was the first selected. The CPP method is delineated in Figure 2.  
Figure 1: Stages for CPP with semantic segmentation for UAV in PV plants. The second was grid-based spanning tree coverage (GBSTC), which works with cellular decomposition, first proposed by [85], and depicted in Figure 3.  
The third method selected for this project was grid-based wavefront coverage (GBWC), first proposed by [86]. The method is illustrated in Figure 4. Each of these CPP methods is explained in more detail in the following sections. (a). The boustrophedon exact cellular decomposition (BECD) Method: This method takes the robot's free space and obstacles and splits them into cells. These cells are covered by the robot using a back-and-forth pattern from the initial point to the final point, using maneuvers of 90 degrees to change direction from south to north or vice versa, as shown in Figure 2. This method improves the trapezoid decomposition technique, as it exploits the structure of the polygon to determine the start and end of an obstacle, and thus is able to divide the free space into a few cells that do not require a redundant step, and it permits the coverage of curved areas [84]. (b). Grid-Based Spanning Tree Coverage (GBSTC): This method is based on approximate cell decomposition and differs from the previous method in that the following postulates were considered. First, the method divides the space into grids of side \(L\). Second, the robot only moves in perpendicular directions to the sides of the grid. Third, every grid is subdivided into four grids of side \(L/2\). Finally, GBSTC discards space that is partly occupied by obstacles. Consequently, considering these previous postulates, the method consists of several stages: in the first stage, a graphic structure is defined, \(S(N,E)\), where \(N\) is nodes, defined as the central point of each grid, and \(E\) is edges, defined as the line segments connecting the centers of adjoining grids, as shown in Figure 3a. In the second stage, the method builds a spanning tree for S, and employs this tree to plan a cover path as follows. Starting in grid \(I\) with a sub-grid of side \(L/2\), the robot begins by travelling between adjoining sub-grids along a path that moves around the spanning tree at a constant distance and in a counterclockwise direction, finishing when the initial sub-grid, \(I\), is found again, which means it is also in the final point, \(F\)[85]. An example of this method is illustrated in Figure 3b. The approximation depends on the side length, \(L\), of the grid. Figure 2: The RoI and the path generated from the initial point (I) to the final point (F) by BECD. (c). grid-based wavefront coverage (GBWC): The first grid-based method proposed for CPP, GBWC is an offline method that uses a grid representation, in addition to applying a full CPP method. The method requires an initial grid, \(I\), and a final grid, \(F\). A distance transformation that propagates a wavefront from the final to the initial point is used to assign a specific number to each item on the grid. That is, the method first assigns a zero to the final item, and then a one to all its surrounding grids. Then all unmarked grids adjoining those marked one are numbered two. The process is incrementally repeated until the wavefront reaches the initial grid [86], as illustrated in Figure 4a. Once the distance transformation is determined, a coverage path can be found by starting at the initial grid, \(I\), and selecting the adjoining grid with the highest number that has not been explored.