In recent years, the technology for crop spraying drones has advanced rapidly, with increasing automation levels making them essential tools in agricultural plant protection. However, current spraying UAV operations typically involve uniform coverage spraying, which, while improving pesticide utilization, often leads to waste in cases of localized pest or disease outbreaks. Precise target spraying represents a critical future direction for crop spraying drone equipment, aiming to reduce production costs, minimize environmental pollution, and enhance pesticide efficacy. Despite this, commercially available spraying UAVs and their ground stations lack precise target spraying capabilities, and users cannot develop such functions on these platforms. To address this gap, we have designed a ground station system for precise target spraying, utilizing hardware such as the DJI A3 Pro flight controller, Jetson TX2 control system, and RTK modules for flight and spray control. Based on Qt and Google Map offline tile maps, we developed ground station software that not only enables basic functions like route planning, spray parameter setting, and flight status display but also supports spraying based on prescription maps. Initial tests demonstrate the system’s feasibility and stability, achieving the desired outcomes and providing a reference for self-developed precise target spraying crop spraying drone systems.
The ground station is a vital component of the crop spraying drone, integrating control, communication, and data processing as the command center of the entire UAV system. It serves as the primary interface for ground operators to interact with the drone. Functions such as task planning, flight parameter configuration, spray parameter settings, real-time flight monitoring, digital mapping, data communication between ground and airborne systems, and remote control are all realized through the ground station. Our developed ground station focuses on controlling basic flight, waypoint mission flight, and spray operations, with a design architecture comprising flight control modules, map modules, and target spraying modules. The software system transmits route tasks and flight control commands via wireless data transmission modules, receives the drone’s position and status information for real-time display, and shows route trajectories on the map interface to track the drone’s movements and remaining tasks. Additionally, it plans routes based on prescription maps and sends waypoint tasks to ensure the crop spraying drone can perform precise target operations in the spray area.
For basic flight control functions in the ground station software, such as takeoff, landing, return-to-home, and three-axis flight, we leveraged the DJI OSDK toolkit, which provides APIs for full autonomous flight capabilities. Before spraying operations, the crop spraying drone requires pre-planned flight routes, where the ground station maps the operational area and plots the drone’s flight trajectory based on relevant parameters. Waypoint mission planning is a key feature of the ground station. The DJI A3 Pro flight controller supports waypoint tasks, and the OSDK toolkit offers corresponding APIs. Users can program custom route planning according to task requirements. Through the ground station software, flight routes are planned on the operational area map, waypoint data is parsed and sent to the drone, which then follows the planned route. In designing the route planning software, waypoint objects are created and initialized before parsing waypoint tasks, including initial route speed, maximum speed limits, and task completion actions. Waypoint data objects store longitude, latitude, and flight altitude, which are then compiled into an array and uploaded to the drone. Executing the start() function from OSDK initiates the waypoint task, enabling the drone to follow the set waypoints.
To achieve route planning functionality, offline map development is essential. Our offline map technology is based on Google tile maps and Google Map API, combining GSM and GPS technologies to quickly build electronic maps and mark current positions. Using the Qt platform with C++ and JavaScript programming, we downloaded tile maps for specific regions and saved them to the Google Map API reference directory. The Google Map API was then called to load the tile maps. In Qt, a QWebFrame class was created to embed JavaScript code, which invokes the Google Map API to read tile map files, thereby loading offline tile maps into the Qt program interface. For route planning algorithms, reasonable route planning can significantly improve the operational efficiency of crop spraying drones. When plotting route trajectories, latitude and longitude are used to calculate distances between adjacent key waypoints, which are essentially spherical distances. Common spherical distance calculations include the great-circle formula and the Haversine formula. The great-circle formula uses extensive cosine functions, leading to larger errors over short distances, whereas the Haversine formula employs sine functions for higher accuracy. Thus, we selected the Haversine formula for distance calculations:
$$ \text{haversin}\left(\frac{S}{R}\right) = \text{haversin}(\text{lon}_2 – \text{lon}_1) + \cos(\text{lon}_2) \times \cos(\text{lon}_1) \text{haversin}(\Delta \text{lat}) $$
where
$$ \text{haversin}(\theta) = \sin^2\left(\frac{\theta}{2}\right) = \frac{1 – \cos \theta}{2} $$
Here, $S$ is the distance between two points, $R$ is the Earth’s radius (taken as 6,371 km), $\text{lon}_1$ and $\text{lon}_2$ are the longitudes of the two points, $\theta$ is the central angle between any two points on the sphere, and $\Delta \text{lat}$ is the latitude difference. Due to the irregular shapes of farmland plots, beyond quadrilateral fields, we designed a route planning algorithm for irregular plots like pentagons or hexagons. Taking a hexagon as an example, with vertices A, B, C, D, E, F and coordinates, if the crop spraying drone’s spray width is $d$, the spacing between adjacent routes is also $d$. To ensure no missed or overlapping sprays, the number of routes is calculated based on vertex distances and route spacing, with the coordinates of each route’s endpoints determined. The total route is divided into $n$ equal parts, where:
$$ n = \frac{\text{getdistance}(\text{lat}_A, \text{lng}_A, \text{lat}_C, \text{lng}_C)}{d} $$
The latitude and longitude of the left endpoints of each route are given by:
$$ \text{lat}_i = \text{lat}_0 + (\text{lat}_1 – \text{lat}_0) \times \frac{i}{n} $$
$$ \text{lon}_i = \text{lon}_0 + (\text{lon}_1 – \text{lon}_0) \times \frac{i}{n} $$
After calculating the left endpoint coordinates, the right endpoint coordinates are similarly determined, allowing the entire route trajectory to be plotted. This algorithm accommodates various polygon field shapes, enabling route planning for irregular plots. For instance, the ground station can plan routes for complex polygons as shown in practical applications.
During spraying operations, the crop spraying drone flies at low altitudes in fields, necessitating monitoring of parameters like latitude, longitude, altitude, and speed for safety. When flight data is transmitted from the drone to the ground station via wireless modules, the ground station software parses it according to communication protocols and marks the corresponding position on the map in real-time, allowing operators to observe the drone’s actual location. The design includes real-time data display, such as flight speed and altitude, to enhance operational control.
For precise target spraying control, the ground station system incorporates functionality for spraying based on prescription maps. Spraying control can be managed by the ground station. Prescription maps are obtained through low-altitude remote sensing analysis or field surveys, identifying distribution areas of pests, diseases, or weeds and their geographic locations. The farmland is divided into grids, with each grid assigned spray requirements based on agricultural conditions. During operation, the flight control system continuously collects the crop spraying drone’s current coordinates and transmits them to the ground station. The ground station compares these coordinates with the prescription map grid positions and returns spray control information to the drone’s spraying system, regulating nozzle on/off states for precise target spraying. Accurate position data for farmland grid areas are acquired using high-precision positioning modules like RTK. We employed the G-RTK module from North Electronics and implemented grid position parsing, comparison, and spray control functions in the ground station. The spraying system’s activation and spray volume are controlled by the ground station based on the prescription map.
Communication between the ground station and the crop spraying drone is established via serial port communication. Before using wireless serial modules for data transmission, the system initializes the serial port by setting parameters such as port name, baud rate, parity, stop bits, and flow control. The baud rate indicates transmission channel bandwidth, parity bits verify data correctness, and stop bits denote the end of a data packet, set to 1 bit for high transmission rates. A custom data transmission protocol ensures reliable communication and coordination. Each data string includes identifiers, data content, padding characters, and end characters. Identifiers allow the receiver to recognize the control function, data content defines commands and parameters, padding characters (e.g., “!”) fill data to maximum length, and end characters (“\r\n”) signal the end of transmission. Communication instructions and data cover basic drone control, waypoint tasks, spray parameter settings, and drone data return. Key instructions are summarized in the following tables:
| Instruction Meaning | Identifier |
|---|---|
| Takeoff | Takeoff |
| Landing | landing |
| Return to Home | gohome |
| Three-Axis Flight Mode | fmode |
| Three-Axis Flight Parameters | fly |
| Instruction Meaning | Identifier |
|---|---|
| Set Spraying Operation Parameters | V;H;L |
| Instruction Meaning | Identifier |
|---|---|
| Waypoint Task Initialization | start |
| Latitude | lat |
| Longitude | lon |
| Waypoint Send Completion | ending |
| Set Route Spacing | interval |
| Set Route Flight Altitude | wpHigh |
| Set Route Flight Speed | wpSpeed |
| Execute Waypoint Task | flying |
| Instruction Meaning | Identifier |
|---|---|
| Current Speed | curVe |
| Current Longitude | curLo |
| Current Latitude | curLa |
| Current Height | cyrHg |
| Successfully Received Feedback | recOk |
After designing the ground station, field tests were conducted on the crop spraying drone to evaluate control over basic flight, waypoint missions, flight status, accuracy, stability, and target spraying responses, such as nozzle on/off and positioning accuracy. These tests, performed in various locations like Xinhui District and Zengcheng, confirmed the ground station’s reliable control functions. Below, we detail tests on route planning and target area spraying control.
For route planning functionality, routes were plotted on the ground station software map interface with a spray width of 3 m. The planned route is illustrated in practical scenarios. Waypoint data from the route was sent to the drone via wireless transmission, and the drone executed the waypoint task. During flight, speed, altitude, and coordinate data were measured by onboard compass and positioning modules and recorded in the flight controller. Using DJI Go software, flight measurement data was read, with recorded values and errors for speed and altitude as shown in the following table:
| Record Point | Set Speed (m/s) | Actual Recorded Speed (m/s) | Set Altitude (m) | Actual Recorded Altitude (m) |
|---|---|---|---|---|
| 1 | 3 | 2.8 | 3 | 2.9 |
| 2 | 3 | 2.9 | 3 | 2.8 |
| 3 | 3 | 2.9 | 3 | 2.9 |
| 4 | 3 | 3.0 | 3 | 3.0 |
| 5 | 3 | 3.0 | 3 | 3.0 |
| 6 | 3 | 3.0 | 3 | 3.0 |
| 7 | 3 | 3.1 | 3 | 2.9 |
| 8 | 3 | 2.9 | 3 | 2.9 |
| 9 | 3 | 2.9 | 3 | 3.0 |
| 10 | 3 | 3.0 | 3 | 3.0 |
| 11 | 3 | 3.0 | 3 | 3.0 |
| 12 | 3 | 3.0 | 3 | 2.8 |
| 13 | 3 | 2.9 | 3 | 2.9 |
| 14 | 3 | 3.0 | 3 | 3.0 |
| 15 | 3 | 2.9 | 3 | 3.0 |
Average values were calculated from the measurements and compared to set values to determine errors, as shown below:
| Flight Parameter | Set Value | Average Recorded Value | Error |
|---|---|---|---|
| Flight Speed | 3 m/s | 2.95 m/s | 0.05 m |
| Flight Altitude | 3 m | 2.94 m | 0.06 m |
In this waypoint task test, the planned route included 10 points, with actual longitude and latitude values recorded as follows:
| Waypoint | Set Longitude | Actual Recorded Longitude | Set Latitude | Actual Recorded Latitude | Waypoint Error (m) |
|---|---|---|---|---|---|
| 1 | 113.697402 | 113.697403 | 23.250683 | 23.250685 | 0.2 |
| 2 | 113.697613 | 113.697615 | 23.250814 | 23.250814 | 0.2 |
| 3 | 113.697643 | 113.697646 | 23.250765 | 23.250766 | 0.3 |
| 4 | 113.697433 | 113.697434 | 23.250644 | 23.250642 | 0.2 |
| 5 | 113.697466 | 113.697469 | 23.250603 | 23.250602 | 0.3 |
| 6 | 113.697696 | 113.697696 | 23.250744 | 23.250744 | 0 |
| 7 | 113.697726 | 113.697725 | 23.250684 | 23.250687 | 0.3 |
| 8 | 113.697508 | 113.697508 | 23.250555 | 23.250556 | 0.1 |
| 9 | 113.697546 | 113.697544 | 23.250514 | 23.250514 | 0.2 |
| 10 | 113.697763 | 113.697764 | 23.250655 | 23.250653 | 0.2 |
Data calculations showed an average error of 0.2 m between actual and set waypoints. Field tests confirmed normal communication between the ground station and the precise target crop spraying drone, with accurate route planning, upload, data return, and display functions, and precise waypoint transmission.
For target area spraying control tests, a key function of the ground station is to enable precise spraying operations for the crop spraying drone. Tests focused on the coordination between ground station software and the drone platform, and the spraying response in target and non-target areas after parameter settings. Tests were conducted under meteorological conditions with wind speeds below level 3. Steps included: 1) Route planning. 2) Setting a spray width of 4.5 m, with each spray grid measuring 4.5 m wide and 5 m long, and non-spray grids 4.5 m wide and 3 m long. 3) Defining spray (target) and non-spray areas in the planned route, and measuring boundary coordinates using RTK-GNSS, with two grids set for no spraying and two for spraying. 4) Placing water-sensitive papers in spray and non-spray areas along the route to observe droplet deposition and assess spraying control responses. Papers were evenly distributed in target areas, with specific spacing, and near boundaries in non-target areas. 5) Setting flight and spray parameters in the ground station interface: flight speed at 3 m/s, altitude at 3 m, and spray volume at 30 L/ha. 6) Initiating the drone for flight operations, collecting papers post-operation to observe droplet deposition. Boundary and center coordinates for spray areas were obtained via RTK-GNSS and integrated into the ground station code, automatically generating control waypoints for spray on/off during route flight. Repeat tests showed that the crop spraying drone reliably sprayed in target areas and avoided spraying in non-target areas based on ground station settings, with deposition results confirming effective control. For example, water-sensitive papers in non-spray areas near boundaries showed minimal deposition due to wind fields, while those in spray areas had significant deposition, validating target spraying functionality. The ground station thus enables precise target spraying control, laying the foundation for prescription map development.
In summary, the ground station designed using Qt and Google Map offline tile technology achieves basic functions such as route planning, flight control input, spray parameter setting, data transmission, and flight data reception and status display for the crop spraying drone. It supports route planning algorithms for polygonal fields and spraying operations in irregular plots. Wireless data transmission modules and custom protocols ensure reliable communication, enabling one-touch takeoff, landing, return-to-home, three-axis flight, and waypoint flight, granting the spraying UAV full autonomous capabilities. Spraying areas can be selected directly on offline maps to control target spraying, with potential for prescription map development to achieve precise target application. The design meets expected functionality, proving the feasibility of the proposed precise target ground station hardware and software solution. Future work will involve refining prescription map functions and conducting field application effectiveness tests for the crop spraying drone system.
