*3.6. Waypoints Graph Generation by Connecting Footprints' Sweeps*

The waypoint graph (WG) is constructed by connecting the footprint sweeps' endpoints for the pathfinding. Mathematically, WG is a double edge graph Γ of inter-reachable locations: Γ = {*W*, *E*}, where *W* represents the nodes set and *E* represents the edge set. The nodes of the Γ are the footprints' sweeps endpoints, while edges are straight lines for each sweep and connection from one sweep to another. Each footprint sweep is a line segment with the two endpoints *a* and *b* (i.e., *Fi* = *ab*) as shown in Figure 6b. We connect the footprints' sweeps endpoint with the coincident (i.e., neighbours) sweeps endpoints to form a WG. Furthermore, in the WG construction process, we consider the obstacles' effect, UAV manoeuvrability constraints and footprints sweep visiting sequence to form the connected Γ. We devise a strategy to avoid obstacles by applying three avoidance options (i.e., left, right, top) in footprints' sweeps inter-connection. Given *N* footprints' sweeps in the form of line segments, we compute the collision-free connections between footprints' sweeps. While constructing the WG, the proposed algorithm evaluates and selects the best obstacles' avoidance option from the candidate options. For the appropriate options selection, the distance is computed between two sweeps by introducing the two points on three sides of the obstacles. The selection of the appropriate obstacle's avoidance option *AOAO* for an obstacle *Oi* is carried out on the basis of following equation:

$$AOAO\_i = \min\{d\_{left}, d\_{right}, d\_{top}\},\tag{7}$$

where *dlef t*, *dright* and *dtop* represent the minimum distance required to avoid an obstacle *i* from left, right, and top, respectively. The value of *d* for each option can be computed between two sweeps with the help of two intermediate points. For example, the distance required to find the collision-free connection between two footprints' sweeps *Fi* and *Fi*+<sup>1</sup> is the sum of the three individual distances (i.e., *d*{(*a*, *b*), *c*),(*c*, *d*),(*d*,(*a*, *b*))}. The value of each option can be calculated with the help of following equation:

$$d\_{lcft} = \sum\_{j=1}^{3} d\_{j\prime} \tag{8}$$

where *dj* represents the minimum distance needed to connect two footprints' sweeps by bypassing an obstacle safely from left. Similarly, the distance values for the other two options are calculated and evaluated for the low cost connection formation. Meanwhile, if no obstacle exists between the footprints' sweeps, and collision can be avoided, then footprints' sweeps are connected with each other via straight lines. The waypoint graph Γ obtained from the AOI possess all properties of a roadmap. A pictorial overview of the waypoint graph Γ obtained by connecting endpoints of the *N* footprints' sweeps from the AOI having size 1500 × 1500 × 400 is shown in Figure 7a.

**Figure 7.** Pictorial overview of the waypoint graph and Back and forth/Zamboni flight pattern.

In Figure 7a, the yellow lines represent the footprints' sweeps and blue lines represent the collision-free connection between sweeps. Meanwhile, the black colour represents the area scanned by sensor footprints' sweeps. The proposed approach is applicable for both types of the UAVs, rotary-wing and fixed-wing. The rotary-wing UAVs present maneuverability advantages when making turns during the flight compared to the fixed wing UAVs. The WG produced by connecting the footprints' sweeps endpoints is directly usable for the rotary-wing UAV. Meanwhile, the fixed-wing UAV has strong maneuverability restrictions, demanding a bigger space to make turns. Therefore, the back-and-forth/zamboni flight pattern can be adopted to generate the WG, where the sweeps will be connected as shown in Figure 7b. In the BF/Zamboni flight pattern, the adjacent sweeps can be connected with the gap *g* of two or three depending upon the complexity of the AOI and sweeps placements. The suggested pattern can simplify the turn and UAV doesn't need to slow down while making the turn. However, the BF/Zamboni flight pattern can lead to the excessive path overlapping in the complex scenarios. The proposed approach simplifies the turns to the extent possible for the easier adoption using both types of the UAVs. The proposed approach generates a sparse WG with minimum nodes and edges to reduce the computational complexity of pathfinding process. The complete pseudo-code used to generate a waypoint graph from AOI is given in Algorithm 1. In Algorithm 1, the AOI *Q* containing *N* number of obstacles, footprint sweeps set *R*, footprint sweeps visiting sequence set *S*, and footprint connection gap *g* are provided as an input. Waypoint graph Γ, where (Γ = {*W*, *E*}) is obtained as an output. Line 2 implements the finding of appropriate footprint sweep to be connected with footprint sweep *Fi* out of *N* − 1 candidates based on optimized visiting sequence and sweeps connection gap. Line 3 implements the identification of the relevant endpoint's pairs through which two sweeps *Fi* and *Fj* will be connected with each other. Line 4 performs the check for the obstacle(s) existence between two sweeps to form the collision-free connection *Ci*. Lines 5–6 implement the connection formation in the presence of obstacle(s) between two sweeps while avoiding the obstacle with low cost option. Line 8 implements the connection formation if no obstacles exist between two sweeps. Furthermore, the same process continues until the complete waypoints is constructed. Finally, waypoint graph Γ of footprints' sweeps connection is returned as an output (line 11).


#### **Algorithm 1:** Waypoint graph generation from the AOI located in a 3D map.
