Real-Time 3D Routing Optimization for Unmanned Aerial Vehicle using Machine Learning

In the realm of Unmanned Aerial Vehicles (UAVs) for civilian applications, the surge in demand has underscored the need for sophisticated technologies. The integration of Unmanned Aerial Systems (UAS) with Artificial Intelligence (AI) has become paramount to address challenges in urban environments, particularly those involving obstacle collision risks. These UAVs are equipped with advanced sensor arrays, incorporating LiDAR and computer vision technologies. The AI algorithm undergoes comprehensive training on an embedded machine, fostering the development of a robust spatial perception model. This model enables the UAV to interpret and navigate through the intricate urban landscape with a human-like understanding of its surroundings. During mission execution, the AI-driven perception system detects and localizes objects, ensuring real-time awareness. This study proposes an innovative real-time three-dimensional (3D) path planner designed to optimize UAV trajectories through obstacle-laden environments. The path planner leverages a heuristic A* algorithm, a widely recognized search algorithm in artificial intelligence. A distinguishing feature of this proposed path planner is its ability to operate without the need to store frontier nodes in memory, diverging from conventional A* implementations. Instead, it relies on relative object positions obtained from the perception system, employing advanced techniques in simultaneous localization and mapping (SLAM). This approach ensures the generation of collision-free paths, enhancing the UAV's navigational efficiency. Moreover, the proposed path planner undergoes rigorous validation through Software-In-The-Loop (SITL) simulations in constrained environments, leveraging high-fidelity UAV dynamics models. Preliminary real flight tests are conducted to assess the real-world applicability of the system, considering factors such as wind disturbances and dynamic obstacles. The results showcase the path planner's effectiveness in providing swift and accurate guidance, thereby establishing its viability for real-time UAV missions in complex urban scenarios.


Introduction
Unmanned Aerial Vehicles (UAVs), commonly known as drones, have emerged as indispensable assets in the aerospace and related sectors due to a confluence of compelling qualities.Among these, cost-effectiveness, accessibility, and mission versatility stand out prominently.UAVs present an economically viable alternative, offering a substantial reduction in operational costs compared to traditional manned aircraft.Their accessibility is unparalleled, allowing for rapid deployment and maneuverability in diverse environments.
The versatility of UAVs extends across an array of tasks, transforming them into valuable tools for applications such as package delivery, law enforcement surveillance, disaster management, infrastructure inspection, agriculture mechanization, rescue operations, and military intelligence.Beyond their cost-effectiveness and versatility, UAVs bring forth additional attributes that contribute to their preference in various sectors.One such attribute is their enhanced safety profile, as UAVs eliminate the need for human pilots to be exposed to potentially hazardous conditions.This aspect is particularly crucial in tasks involving disaster response, hazardous material monitoring, or surveillance in P. Mishra, B. Boopal and N. Mishra 2 challenging terrains.The reduced risk to human life positions UAVs as ideal candidates for missions where safety is paramount.Furthermore, UAVs offer a unique aerial perspective, enabling them to access hard-to-reach or remote areas that may be inaccessible or hazardous for ground personnel.This aerial vantage point proves invaluable in scenarios such as search and rescue operations, wildlife monitoring, and environmental surveying.The ability to capture highresolution images and real-time data from above facilitates informed decision-making, making UAVs instrumental in research, monitoring, and assessment tasks.UAVs also exhibit environmental benefits, contributing to sustainable practices in various industries.Their lower carbon footprint compared to traditional aircraft aligns with the growing global emphasis on ecofriendly technologies.In applications like precision agriculture, UAVs play a pivotal role in optimizing resource usage, reducing environmental impact, and enhancing overall efficiency.Moreover, the agility and adaptability of UAVs make them well-suited for dynamic and evolving situations.Their ability to be rapidly deployed and reconfigured for different missions enhances operational flexibility.This trait is particularly advantageous in scenarios where swift responses are imperative, such as emergency services, law enforcement, or monitoring rapidly changing conditions.
During ongoing research on Unmanned Aerial Vehicles (UAVs), the integration of Artificial Intelligence (AI) and advanced computer vision technology has ushered in a new era of capabilities, particularly in the domain of route planning and navigation.As UAVs find increased applications in cluttered and dynamic environments, the traditional reliance on Global Positioning System (GPS) for vehicle localization faces limitations.In response, researchers [1] have turned to a fusion of sophisticated sensors, including visual cameras, Inertial Navigation Systems (INS), and GPS [2], to achieve precise UAV localization and navigation.The synergy of these sensor inputs [3] has proven crucial for overcoming challenges posed by obstacles in the UAV's flight path, such as trees, buildings, and other impediments.Computer vision technology has been pivotal in elevating the capabilities of UAVs beyond mere localization.It empowers UAVs not just to pinpoint their position but also to detect and navigate around obstacles.This is achieved through the implementation of high-performance computers capable of rapid data processing, enabling the development of intricate vision-based navigation algorithms.Researchers, including Abdulla Al-Kaff [4], Wagoner et al. [5] and Lidia et al. [6], have dedicated efforts to exploring and analyzing these algorithms, which contribute to autonomous navigation, precise control, effective object tracking, and obstacle avoidance.
Concurrently, the integration of AI into UAV navigation systems has revolutionized route planning.AI imparts humanoid perception to UAVs, enabling them to operate semi-or fully autonomously.Studies by Su Yeon Choi and Dowan Cha [7] delve into the historical development of AI in UAVs, shedding light on control strategies, object recognition, and machine-learning-based path planning and navigation methods.This infusion of AI equips UAVs with the ability to learn from their environment, make decisions, and adapt their navigation strategies based on real-time data, fostering a level of autonomy previously unattainable.The symbiosis between AI and computer vision technologies assumes paramount importance in civilian applications of UAVs, where challenges in wildlife monitoring, disaster management, and search and rescue operations demand a sophisticated and adaptable approach.Christos and Theocharis [8], Luis F. Gonzalez et al. [9], and Eleftherios et al. exemplify how the incorporation of AI and computer vision capabilities into UAVs facilitates the resolution of specific challenges inherent in these diverse domains.The culmination of these technological advancements empowers UAVs with heightened environmental awareness, paving the way for more effective and collision-free path planning.The challenges associated with real-time path planning, including the integration of multiple sensors, data synchronization, and computational burdens, are addressed by researchers like Valenti et al. [10] and Yuncheng et al. [11] Moreover, Yan et al.'s [12] exploration of a deep reinforcement learning technique for real-time path planning in dynamic environments represents a promising avenue, despite considerations regarding the assumption of predetermined global situational data and the absence of real-flight testing.
In a bid to further mitigate computational burdens, this study proposes an innovative approach by integrating the fastest object detection algorithm with a light-weight 3D path planner based on YOLO (You Only Look Once).Renowned for its speed, YOLO enhances the efficiency of real-time path planning, thereby addressing the challenges associated with intensive computational requirements on companion computers dedicated to UAV localization, obstacle detection, and 3D path planning.The comprehensive report unfolds the proposed methodology, outlines the hardware and software components, and explores the configurations that contribute to optimizing UAV performance in dynamic and cluttered environments.The incorporation of these cutting-edge technologies not only enhances the capabilities of UAVs but also marks a significant stride toward realizing their full potential in a myriad of real-world scenarios.

Methodology
In the quest to enable real-time object detection and 3D path planning on a companion computer embedded in a UAV, a pivotal stride involves the seamless integration of the fastest object detection algorithm and a 3D path Real-Time 3D Routing Optimization for Unmanned Aerial Vehicle using Machine Learning 3 planner that imposes minimal computational burden.YOLO (You Only Look Once) [13] has emerged as the algorithm of choice for object detection, attributed to its exceptional speed.Beyond its fundamental role in detecting objects, YOLO also furnishes critical localization information for the detected objects.Leveraging this data, the proposed 3D path planner orchestrates the computation of a collision-free trajectory for the UAV by strategically utilizing the relative locations of detected objects [14].While bearing a semblance to the A* path planning algorithm in incorporating a heuristic function for cost minimization, the proposed 3D path planner strategically departs from the conventional exhaustive search for consecutive collision-free nodes and the storage approach employed by A*.Departing from the traditional A* methodology, the proposed planner maps the current UAV location to a specific set of nodes positioned strategically between consecutive obstacles.This strategic mapping is based on factors such as the UAV's size and the gap between successive obstacles.A Euclidean function is ingeniously employed as the heuristic function in this 3D path planner, thereby enhancing its computational efficiency.
The modifications introduced in the proposed 3D path planner [15], departing from the conventional A* algorithm, are meticulously designed to address key challenges inherent in real-time collision-free path planning for Unmanned Aerial Vehicles (UAVs) navigating through cluttered environments.A critical adjustment involves strategically reducing the exhaustive search typically undertaken by the traditional A* algorithm.This reduction aims to optimize computational resources, crucial for UAVs requiring swift decisionmaking capabilities.Furthermore, enhancements in the storage method have been implemented to minimize memory usage, recognizing the constraints often associated with UAVs' onboard computational capabilities.Unlike the traditional A* approach, the proposed planner strategically maps the UAV's current location to a select number of nodes between consecutive obstacles.This strategic node mapping, influenced by factors such as UAV size and gap between obstacles, streamlines the path planning process, enabling quicker decision-making and trajectory computation.Additionally, the heuristic function, crucial for cost minimization in both A* and the proposed planner, undergoes a specific adaptation.The introduction of a Euclidean function as the heuristic enhances computational efficiency, simplifying cost estimation and guiding the UAV toward collision-free paths.These modifications collectively ensure that the 3D path planner is not only adept at generating optimal paths but also tailored to the unique characteristics and constraints of UAVs, making it a robust solution for real-time applications in dynamic and complex environments.
Moving forward, the subsequent step involves an in-depth evaluation of the proposed 3D path planner within a simulated environment.This evaluation is facilitated by software tools, with Gazebo 3D dynamic environment simulator taking center stage.Originally tailored for algorithm assessment within the realm of robotics [16][17][18], Gazebo excels in providing realistic rendering of the environment in which the UAV navigates.Furthermore, the simulator boasts an array of simulated sensors, augmenting its capabilities for conducting comprehensive tests.To augment the evaluation process, a meticulously designed simulated cluttered 3D environment within Gazebo serves as the testing ground.This simulated environment not only mirrors real-world challenges but also allows for an iterative assessment of the proposed 3D path planner's performance across successive development stages.In this simulated environment, the 3D path planner interacts with the Gazebo simulator, navigating the UAV through the intricacies of the designed 3D space.The simulator incorporates various sensor inputs, simulating real-world scenarios, and facilitating the testing of collision-free path planning under different conditions.This iterative process ensures that the proposed 3D path planner is robust and adaptive, capable of handling the dynamic challenges presented in cluttered environments.Thus, the synergy between the YOLO algorithm, the innovative 3D path planner, and the Gazebo simulator underscores a comprehensive approach to developing and validating a real-time, collision-free path planning system for UAVs.

Software and Hardware Tools
The employment of Software-In-The-Loop (SITL) simulation stands as a widely adopted practice for assessing algorithmic performance during the developmental phase, offering a streamlined and costeffective alternative to real-flight testing scenarios, thereby mitigating potential risks and avoiding the financial and temporal implications of actual crashes.In the developmental and evaluative phases of the 3D path planner, an amalgamation of open-source software components, including the px4 flight control firmware, Gazebo simulator, and Robot Operating System (ROS), was seamlessly integrated.Gazebo, revered for its dynamic 3D model simulation environment, proved particularly adept at facilitating tasks such as obstacle avoidance and computer vision, enriched by simulated sensors that faithfully replicate the functionality of real UAV onboard sensors.The YOLO object detector, endowed with its Darknet architecture and encapsulated within the ROS framework, played a pivotal role by disseminating crucial information pertaining to obstacles present in the UAV's navigation environment.
For the rigorous validation of the YOLO object detector [19][20][21][22][23][24][25], a meticulous process involved capturing images of 3D models of simulated objects within the Gazebo environment, encompassing diverse backgrounds and varying lighting conditions.The implementation of the 3D path planner algorithm, serving as the impetus for the px4 flight controller to issue actuator commands to the quadcopter model ensconced within the Gazebo simulator, took shape as a dedicated ROS node.The hardware models emulated in this SITL Gazebo simulation included the iris quadcopter, a depth stereo camera, three ultrasonic sensors, and the LiDAR system, depicted in Figure 1.
Each hardware component was assigned a distinct function within the simulation setup: the frontal camera adeptly captured environmental images, the LiDAR system collaborated with GPS for precise quadcopter altitude estimation, and the ultrasonic sensors diligently detected lateral obstacles during both take off and rolling manoeuvres.The 3D path planner seamlessly extracted relevant information from these sensors within the Gazebo simulator, facilitated by the Gazebo_ros packages that empower sensors to publish their valuable data.Importantly, the entire simulation framework operated on a desktop computer, and the comprehensive software specifications of this system are meticulously detailed in Table 1.This holistic simulation environment ensures a robust testing ground for the iterative development and validation of the 3D path planner algorithm, offering insights into its performance dynamics and adaptability to a diverse array of scenarios and challenges within cluttered environments.

Machine Learning Implementation for 3D path planner
The preeminent challenge in the domain of autonomous navigation for Unmanned Aerial Vehicles (UAVs) revolves around the intricacies of crafting a meticulously planned, obstacle-free route from an initial point to a designated destination.This challenge assumes paramount significance, particularly in missions such as law enforcement, package delivery, and first aid interventions within urban landscapes, where the likelihood of encountering obstacles is significantly heightened.A noteworthy observation pertains to the adaptation of numerous path planning algorithms originally designed for ground robots, predominantly residing in a twodimensional (2D) space.The adaptation of these algorithms to the three-dimensional (3D) environment that aerial vehicles operate within introduces complexities, demanding high-performance onboard computers.
The intricacy arises from the demanding nature of designing 3D path planners, imposing a substantial computational burden.
Mathematically, this computational demand is encapsulated by the algorithmic complexity, often expressed as a function of input size (n) and denoted by Big O notation (O(f(n))).The obstaclefree 3D path planning process, which involves tasks such as graph creation, cost minimization, and heuristic prioritization, contributes to this algorithmic complexity.The critical challenge posed by this complexity is its potential impact on the UAV's maximum cruising capability.Numerous well-established 3D path planning algorithms are deployed to address this challenge, leveraging mathematical frameworks to optimize navigation strategies.These include A* with its variants, Rapidly-Exploring Random Tree (RRT) along with its variants, Probabilistic Road Maps (PRM), Artificial Potential Field (APF), and Genetic or Evolutionary algorithms.The underlying mathematical formulations of these algorithms involve equations and functions designed to navigate the UAV through intricate spatial configurations while minimizing computational resources.
In contrast, node/grid-based algorithms differ by exhaustively exploring consecutive nodes.A prime example is the A* algorithm and its variants.In the pursuit of an obstacle-free path, these algorithms ingest an environmental image, discretize it into grid cells encompassing the UAV's current (start) location and the designated goal.The A* algorithm employs two critical functions for prioritizing cells to be visited: the cost function, computing the distance from the current cell to the next, and the heuristic function, calculating the distance from the next cell to the cell harbouring the goal.The prioritization of cells is accomplished by minimizing the sum of these two functions.In the context of a 3D search, the cost function calculates distances from the current cell to all 26 neighbouring cells, while the heuristic function gauges the distance from these 26 cells to the cell housing the goal.However, in cluttered environments with intricate occlusions, the necessity for highly dense grid cells amplifies the computational burden, potentially leading to suboptimal path selections.The intricacies of 3D path planning underscore the ongoing pursuit for algorithms that can efficiently navigate UAVs through dynamic and complex terrains while optimizing computational resources and ensuring optimal paths in cluttered environments.
Pioneering a transformative approach to UAV navigation entails the comprehensive training of an on-board computer, empowering it to swiftly identify objects and adeptly execute collision avoidance manoeuvres within the intricate tapestry of its navigational environment.This paradigm shift mirrors the cognitive strategies deployed by humans to avoid collisions, drawing a direct analogy between the computational intelligence of a human brain and the artificial intelligence ingrained in the on-board computer of a UAV.The significance of rigorous training for the on-board computer becomes evident as it seeks to emulate and, ideally, surpass the collision avoidance prowess exhibited by human operators.
Going beyond the fundamental capability of detecting objects and establishing their relative locations in relation to the UAV, the companion computer assumes the responsibility of discerning the specific types of detected objects.The YOLO (You Only Look Once) object detection algorithm, seamlessly integrated into the companion computer's framework, excels in this regard.Its multifaceted functionality extends beyond mere detection, offering insights into the categorization of objects based on their distinct types.This level of sophistication is imperative because effective collision avoidance strategies hinge on an intricate understanding of the nature of the detected obstacles.
A pivotal consideration in collision avoidance is the diversity of objects encountered in the UAV's navigational path.Different objects demand distinct strategies for evasion, taking into account factors such as their physical characteristics and spatial configurations.For instance, the avoidance mechanism for an open obstacle like a window drastically differs from that tailored for a closed obstacle, such as a tree.Recognizing the need for a nuanced approach, our 3D path planner has been meticulously designed to encompass these sophisticated capabilities.
The 3D path planner stands as a testament to our commitment to elevating UAV navigation to new heights.By seamlessly integrating object detection insights from the YOLO algorithm, our planner not only identifies and locates obstacles but also categorizes them based on their specific types.This wealth of information is leveraged to tailor collision avoidance strategies, ensuring the UAV's safe passage through its dynamic environment.The fusion of advanced object detection and categorization capabilities within the 3D path planner exemplifies our dedication to pushing the boundaries of UAV navigation, ultimately enhancing its safety, efficiency, and adaptability across diverse operational landscapes.

Results
During the developmental phase of the path planner, a series of performance tests were meticulously conducted to validate its functionality and efficacy.In the initial stage of performance evaluation, computer-simulationbased tests served as a crucial precursor to real-world flight assessments.These simulated tests provided a controlled environment where the path planner's algorithms and functionalities could be rigorously scrutinized and refined.The utilization of advanced software tools allowed for a detailed examination of the planner's response to various scenarios, enabling the identification and rectification of potential issues in a riskfree virtual setting.The implemented software tools played a pivotal role in these simulation-based tests.Their integration and seamless operation were critical to replicating real-world scenarios and validating the path planner's performance under diverse conditions.

SITL Results
Two Gazebo simulation environments, designed to replicate real-world conditions, were constructed with front and top views specifically tailored for testing the path planner.These simulated settings served as controlled arenas where the path planner's functionalities could be rigorously assessed and fine-tuned before realworld deployment.The front view (Fig. 1) simulation provided a comprehensive representation of the UAV's navigational perspective, allowing for the evaluation of the path planner's decision-making capabilities in response to various obstacles and environmental nuances.This view facilitated a detailed analysis of the planner's performance in terms of object detection, path planning, and collision avoidance from the frontal aspect.Simultaneously, the top view (Fig. 2) simulation offered a bird's-eye perspective, providing a holistic view of the UAV's trajectory and interactions within the environment.This vantage point enabled a thorough examination of the planner's efficiency in navigating through complex terrains, detecting obstacles, and strategically planning paths from an overhead standpoint.
The Gazebo world is subdivided into distinct left and right sections, each characterized by a width (y-axis) of 10 meters and a length (x-axis) of 30 meters.In the left section, the UAV is strategically positioned, and its mission entails navigating through the dynamically arranged obstacles to reach the designated landing pad situated in the right section.To simulate real-world challenges, path planner performance tests are conducted within this Gazebo environment, where poles and trees are randomly repositioned.This variability in obstacle placement ensures that the UAV's path alterations accurately reflect the adaptability and responsiveness of the path planner to dynamic scenarios.The ever-changing arrangements of obstacles prompt the UAV to adjust its trajectory, validating the robustness of the path planner under varying conditions.The Gazebo world incorporates 3D models of diverse obstacles crucial to mimicking real-world scenarios.These obstacles include pedestrians, open windows, poles, tunnels, trees, and two consecutive nets.The selection and design of these obstacles are meticulously aligned with potential threats encountered during UAV missions related to in-house first aid, law enforcement surveillance of suspects, and door-to-door package delivery services in urban settings.By introducing these diverse obstacles, the simulation environment emulates the challenges faced by the UAV during its mission, necessitating strategic navigation around or through these obstacles en route to the targeted location, exemplified by the landing pad.This comprehensive testing approach ensures the efficacy of the path planner in addressing real-world complexities and enhances its reliability in executing mission-critical tasks in urban environments.The comprehensive simulation infrastructure, illustrated in Figure 3, orchestrates the seamless interaction between various components.The livestreamed videos from the ground control station for UAVs were meticulously recorded for subsequent analysis.Specifically, snapshots of the video frames at key moments, such as instances of attitude or altitude changes aimed at avoiding obstacles, were captured and are now presented for examination (Fig 4 -5).These snapshots offer a visual insight into the UAV's dynamic response and navigation strategies implemented by the 3D path planner in real-time scenarios.By reviewing these recorded moments of critical manoeuvres, a detailed assessment of the path planner's effectiveness in obstacle avoidance and adaptive decision-making during attitude and altitude adjustments can be conducted.

Conclusion
In summary, this paper introduces a novel approach to real-time collision-free path planning for UAVs by seamlessly integrating the YOLO object detection algorithm with an innovative 3D path planner.The YOLO algorithm's speed and localization capabilities contribute vital information to the proposed 3D path planner, which strategically departs from traditional A* methods to address challenges in cluttered environments.The planner optimizes computational resources by reducing exhaustive searches, refining storage methods, and employing a Euclidean heuristic, demonstrating its efficiency.The comprehensive evaluation in Gazebo, coupled with the synergy between YOLO, the path planner, and the simulator, underscores the system's robustness for dynamic and complex UAV navigation.Furthermore, the paper sheds light on the significance of a holistic simulation environment, leveraging Software-In-The-Loop (SITL) simulation tools like px4, Gazebo, and ROS for comprehensive algorithmic assessment.The detailed integration of these tools in a simulated cluttered 3D environment ensures rigorous testing, addressing realworld challenges faced by UAVs.Additionally, the paper explores the computational complexities inherent in 3D path planning and highlights the adaptability of the proposed planner to diverse scenarios, offering an efficient solution for collision-free navigation.The fusion of advanced object detection, categorization, and path planning capabilities within the proposed system signifies a pioneering step toward enhancing UAV safety, efficiency, and adaptability in complex operational landscapes.
In the concluding section, the paper emphasizes the pivotal role of performance tests, encompassing simulation-based evaluations.The Gazebo simulations meticulously replicate dynamic scenarios, illustrating the planner's adaptability to obstacles, such as poles, trees, and nets, in an urban environment.The paper underscores the responsiveness and effectiveness of the 3D path planner through livestreamed video analysis, providing visual insights into the UAV's real-time response and navigation strategies.This comprehensive research effort, combining cutting-edge algorithms, simulation tools, and performance tests, positions the proposed system as an innovative and efficient solution for real-time collisionfree path planning, marking a significant contribution to the field of autonomous UAV navigation.