# Flying Watchdog-Based Guard Patrol with Check Point Data Verification
## 4 Results and Discussion  
In this research, our experimentation involved configuring the drone for automated flight, following a predetermined flight path with designated waypoints. Four specific checkpoints, namely CP-1, CP-2, CP-3, and CP-4, were integrated into the flight plan, as illustrated in Figure 1. To facilitate this, we harnessed an open-source platform, such as Mission Planner, to predefine the flight path and establish checkpoint locations for each Point of Interest (PGP). During the actual flight test, we activated the search mode when the drone reached the final checkpoint, CP-4. At this juncture, the drone autonomously navigated toward CP-4 and initiated a search mission to pinpoint the PGP's exact location. Leveraging computer vision technology based on distinct glowing patterns, the drone identified the PGP's position and hovered in place for 10 s to facilitate data transmission. The outcomes of our testing phase are graphically represented in Figure 7, which illustrates the drone's circular flight path around the CP-4 location, maintaining a radius of 1 m. The search maneuver was executed by controlling the drone's rotational angles, including pitch, roll, and yaw, while it remained in search mode for 30 s.  
The overview of the code snippets depicted in Figure 8 are crucial elements within the Drone Control system. These code snippets are scripted in Python and play a vital role within the context of the ROS package installed in the 'catkin_ws.' The primary focus here is the interaction between the NVIDIA Jetson and the flight controller, which involves establishing MAVLINK communication via MAVROS and configuring communication parameters. Furthermore, we delve into the utilization of MAVROS for tasks such as reading APM firmware configurations, managing the altitude of the delivery drone, and importing essential messages from'mavros_msgs.' These messages facilitate reading APM firmware configurations, a task enabled through a 'yaml' file that provides crucial state information regarding the application, particularly on the watchdog drone. The initial code snippet (Figure 8, Code Syntax: Drone Control, Line 1) configures the MAVROS port for communication with the Flight Controller. It specifies the serial port as '/dev/tyTHS1' and sets the baud rate, establishing a connection with Telemetry 2 or flight controller UART port. The code snippet featured in Figure 8, under the sections \"LED Detection Python script\" and \"Shape Identification,\" is responsible for processing camera images to detect color and shape. This code snippet commences by capturing a frame from a camera source using the 'cap.read()' function. The frame is then resized according to predefined horizontal and vertical resolution parameters, ensuring uniformity in image processing. For color-based object detection, the frame converts from the default BGR color space to HSV (Hue,  
Figure 8: Drone control and image detection source code. Figure 7: Flying watchdog check-in scenario and results. Saturation, Value) using 'cv2.cvtColor.' HSV is the preferred color space for segmentation because it isolates color information (Hue) from brightness (Value) and saturation. Color segmentation is achieved by establishing lower and upper HSV bounds for the target color, which, in this case, is red. These bounds are defined as 'lower_red' and 'upper_red.' Pixels falling within these boundaries represent the red color, for instance. Two masks,'mask1' and'mask2,' are generated to isolate primary and secondary red regions based on the specified HSV bounds. These masks are then merged to form a final mask ('mask') that accommodates variations in red hues. This last mask is employed to identify contours within the image via 'cv2.findContours.' Contours are continuous curves that delineate object boundaries within the frame. In this context, the contours signify regions of red color. The code subsequently proceeds with shape identification, although the specific code for shape recognition is not provided.