# Time Optimization of Unmanned Aerial Vehicles Using an Augmented Path
## 4 Augmented Path Mapping Algorithm  
Algorithm 1 is the first initializer of the program it sets of the system. It is the trigger, after which all the later algorithms follow. The Euclidean function is initialized. This function is used for calculating the set of values that defines the set of coordinates that the drone has to follow for keeping on the path. It also calculates the midpoint of the path. This midpoint is used for finding the point of descent at which the drone has to decrease its altitude to reach the ground at precisely the exact location. To keep everything in check and track the values, a counter is set up with an initial value of zero. The counter values decide what is being calculated at the point being calculated. ```
Input: Initial and Destination Point Output: Coordinates and Scale Of 3 Points Of Path Initialization of variable: Assign zero to variable count, i Initialize function Euclidean distance (0 )  Fetch parameters and store inside array a[], b[], Cal[]  dist. = ((a[i] - b[i]) \(\times\) 2 + 550/((a[i + 1] + b[i + 1])/2) (a[i + 1] - b[i + 1]) \(\times\) 0.5  Cal[i] = (a[i] + b[i])/2  Cal[i + 1] = (a[i + 1] + b[i + 1])/2)  Cal[i + 2] = (a[i + 2] + b[i + 2])/2)//mid-point coordinates x, y, z  Increase count to 1 Return(cal[])
```  
**Algorithm 1** Algorithm to design the path  
Algorithm 2 is the ascent function that is used to define the path the quad has to follow while starting its ascent. The path is to be defined on all the axis, i.e., x, y, z-axis. There is also a mid-variable that keeps checking the coordinates and at precisely the midpoint the function ascent is ended, or the regulated height through the barometer readings to fly below the legally allowed height for the UAVs. Figure 2: Proposed augmented path-time architecture. Now, there are two conditions if the midpoint or the height limit is reached first and that triggers either of the three or four functions, i.e., descent or the straight path. ```
Input: Initial, destination, and cal point Output: coordinates of ascent path  Initialize Function Ascent ()  Fetch parameters and store inside array a[], b[], Cal[]  Fetch manual real time readings from gyro meter for inclined angle  a variable with regulated permitted height If(count == 1)//check the previous functions  Compute and store next set of coordinates using equation x = y = z  Check the coordinates with cal[] If true increase the count by 1  Initialize function descent ()  Break/ /end the ascent  Else If height == barometer readings  Initialize function straight()  Break/ /start straight  Else continue
```  
**Algorithm 2** Algorithm for an ascent  
If the mid-point is reached first, then Algorithm 3 or the descent function is initialized. The descent function is used to track the descent path using their respective equations. It has an end variable, which checks the final coordinates with the live coordinates and thus the progress is checked. All this is calculated in real-time and modified simultaneously during the flight of the quad (see Algorithm 3). ```
Input: Initial, destination, and cal point Output: Coordinates of descent path Initialize function ascent ()  Fetch parameters and store inside array a[],b[],Cal[]  Fetch automatic real time readings from gyrometer for inclined angle If(count)=2)//check the ascent  x = a ((0 - s in)


```
Initialize Function Straight () Fetch manual real time readings from gyro meter for inclined angle If(count == 2) | | (height == barometer readings)//only after ascent  Height remains constant  X = x + 1//only x changes following a straight path If(coordinates == cal[])  Initialize function descent 0 Else continue
```

**Algorithm 4** Algorithm for a straight path

### Calling Technique of the Algorithm

When the algorithm is compiled, it calls for values from the Blackbox via the function call, which already has the simultaneous values of the respective modules, i.e., gyro, barometer, etc., which is used in the flight controller for balancing and motor control of the quad.