# Adaptive Path Planning for UAV-Based Pollution Sampling
## 3 Materials and Methods
### Methodology for Mission Planning  
A typical methodology for mission planning and execution using the Adaptive Path Planner (APP) is illustrated in Figure 2. The mission planning process begins at the Ground Control Station (GCS), where the team utilizes current weather data and forecasts and optionally projected pollution concentrations to draft a comprehensive plan. This includes outlining the flight zone, developing a measurement strategy, and finalizing essential payload configuration for the UAV. Figure 1: Visualization of mission use cases for Adaptive Path Planner development. In the subsequent phase, an environment map is generated using input from human experts combined with data retrieved from external resources like weather forecasting systems or pre-calculated weather models. This map includes key features such as terrain elevation, airspace boundaries, and predicted wind dynamics. If estimated pollution concentration data were specified, the map would also incorporate a measurement layer. Once the environment map is prepared, it is delivered to the APP for further processing and beginning the initialization phase. In this phase, the GPP generates the global and initial local paths through the optimization of global waypoint locations and mission parameters. This process takes into account multiple optimization criteria, such as preferred flight zones, measurement-specific requirements, wind velocity, and estimated energy consumption. However, the global waypoints provided by the GPP serve only as approximations of the final route. They represent key positions that the UAV must reach while navigating along an adaptive local path. The planned path undergoes validation through simulation using Model-in-the-Loop (MIL) and/or Software-in-the-Loop (SIL) methodologies. Upon passing validation, the path requires final approval from a human operator. If it is not approved, the mission moves back to the planning phase. The finalized path is transmitted to the UAV. Prior to the start of the mission, the UAV undergoes initialization. Any detected errors are logged, and the system shuts down, resulting in mission termination. If no errors are identified, the mission proceeds, with a human pilot manually handling takeoff and guiding the UAV to the first global waypoint. Figure 2: Methodology for mission planning and execution using the APP framework. Once this waypoint is reached, the autonomous system assumes control, directing the UAV along the pre-planned path. The global path can be adjusted mid-mission. Once the settings are updated, the APP re-initializes while the UAV stays airborne. The new path, if validated and approved, is sent to the UAV, and the LPP automatically adjusts to it if required. Should the next waypoint become unreachable or if the environment map is modified without providing a new local path, the LPP is activated to generate an alternative route to the next global waypoint. This local fallback path is calculated offboard at the GCS using the LPP and then transmitted to the UAV. In cases of communication loss, the LPP operates directly onboard the UAV. Depending on the specific scenario, onboard computations can be preconfigured to run by default. The UAV controller subsequently attempts to follow the path defined by the local waypoints. If an error is detected, the UAV plans a route to a predefined emergency landing site to execute a Return-To-Home (RTH) maneuver. In the event of a critical failure during RTH, the UAV transitions to emergency mode, deploying a parachute and transmitting a distress signal with its current location. Afterward, the UAV's primary systems are powered down to ensure safety. The detailed behavior of the controller and the decision-making module supporting it represents a complex topic beyond the scope of APP. As such, these aspects are not explored further in this article. The outlined steps are performed iteratively until the UAV arrives at its designated final global waypoint.