## 4 Hardware and Software Sub-Framework Navigation and Flight Control (HSFW3) Design
Soft, which ensures the operation of computer vision for navigation, adapts to the elements of artificial intelligence for the detection and classification of oil slicks. The software package for estimating the speed and position of the drone, recognition, and flying around obstacles on the drone's route consists of Opticalflow, Visual Intertial Odometry (VIO), and ObstacleAvoidance. These programs are also adaptable to interact with Priority HSFW. The autonomy of the monitoring mission is very important, whether for the availability of the method (no need to have a qualified operator) or for increasing the effectiveness of monitoring. The latter is ensured by the most efficient decisions that AI elements make \begin{table}
\begin{tabular}{c c c} \hline \hline
**Title** &
\begin{tabular}{c} **Measurement** \\ **Unit** \\ \end{tabular} & **Value** \\ \hline Maximum flight time & min & 45 \\ Maximum flight speed & min/s & 11 \\ Maximum lifting capacity & kg & 3 \\ Drone weight & kg & 7 \\ Maximum permissible wind speed & m/s & 6 \\ Possibility of splashdown on the water surface (maximum wave height) & m & Smooth wavelets 0.5 \\ Ability to fly during precipitation (rain, non-sticky snow) & - & N/A \\ Recommended flight altitude range & m & 20–150 \\ The maximum speed of the vessel when landing the drone & m/s & 1.5 \\ Maximum possible power consumption of the payload, for monitoring & W & 200 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Main features of the drone for oil pollution monitoring. Figure 6: Drone flooding. concerning numerous factors, including residual battery power and weather conditions. Control of the drone manually, concerning all necessary factors, is almost impossible. The preparation of the flight task is completely carried out by the operator on the basis of required flight route, in the following mission planner programs: qGround Control, Mission planner, DroidPlanner, and custom-made software (custom firmware). The program window (PX4) with the compiled flight task for monitoring the water area is shown in Figure 7. The operator has the ability to select the territory of the overflight, the step size of the drone's movement during the overflight, and the overflight height. The flight step is calculated as a function of the flight altitude and the camera's field of view, such that, for each drone pass, the camera captures 15-20% of the territory surveyed in the previous pass. The flight altitude is selected according to the estimated size of the oil slick. For the RPI-CAM-V2 camera, the average monitoring height is in the range from 50 to 100 m above the water level. The operator can select the point of automatic takeoff and landing of the drone. In the case of a situation where takeoff is made from a moving vessel, the choice of a fully automatic mode of landing is available. Landing on a moving object is a necessary operation to complete the monitoring mission. For its implementation, the capabilities of the flight controller, due to its interaction with a computer, an artificial intelligence element of the HSFW3, and Priority HSFW needed to be expanded. Priority HSFW generates the corresponding commands for the HSFW3, after analyzing all the data necessary for landing on a moving object. Several resistive sensors were installed inside of the drone for water leakage. When water gets inside the hull, the takeoff function is automatically turned on, and landing on water is prohibited until the end of the mission is turned on. Control of the flight controller when landing on water is carried out by a computer installed in the drone. Resistive sensors for the presence of liquid in the body (hull) are also connected. All interactions of the computer with the flight controller of the drone are carried out through the Robot Operating System--the MAVROS package, via the UART bus. The computer can both request any data that the flight controller operates and change the waypoints of the flight task, as well as directly control the inclination, the altitude, and other actions of the flight controller.