#### Abstract

The hilly farmland in China is characterized by small farmland areas and dense farmland distribution, and the working environment is three-dimensional topographic farmland, so the working conditions in the field are relatively complex. In this working environment, the coverage path planning technique of a farmland autonomous task is harder than that of 2D farmland autonomous task. Generally, the path planning problem of 2D farmland is to construct the path cost model to realize the planning of agricultural machinery driving route, while for the path planning problem of three-dimensional terrain farmland in the hilly region, this paper proposes a covering path planning scheme that meets the requirements of autonomous work. Based on the energy consumption model, the scheme searches the optimal driving angle of agricultural machinery, prioritizes solutions to the problem of covering path planning within the scattered fields in the working area, and then searches through the genetic algorithm for the optimal order of traversing the paths of each field to complete the coverage path planning in the working area. On the one hand, the scheme optimizes the planning route in the fields from the angle of optimal energy consumption; on the other hand, through the genetic algorithm, the fields are connected in an orderly manner, which solves the comprehensive problems brought by the unique agricultural environment and farming system in China’s hilly areas to the agricultural machinery operation. The algorithm program is developed according to the research content, and a series of simulation experiments are carried out based on the program using actual farmland data and agricultural machinery parameters. The results show that the planned path obtained at the cost of energy consumption has a total energy consumption of 4771897.17J, which is 17.4% less energy consumption than the optimal path found by the path cost search; the optimization effect is evident.

#### 1. Introduction

Coverage path planning (CPP) refers to a kind of static global path planning in which a robot can completely cover the entire work area through autonomous tasks [1]. Compared with dynamic, real-time path planning, the environmental conditions of the covered path planning are known, and the algorithm design of the path planning covering the entire operation area is completed. CPP has high practical application value in many fields, such as indoor area cleaning operations, unknown area coverage detection operations, and hazardous area operations [2–4]. Different areas have different requirements for coverage tasks, which makes CPP pertinent and unique in algorithm design. In the agricultural production field, CPP schemes are mainly to solve actual field production needs: on the one hand, demand is the result of agricultural machinery modernization; on the other hand, it is a combination of problems arising from the natural environment and agricultural system. Thus, the CPP technology in the field of agriculture has particularity and complexity.

Path planning is of great significance in the field of unmanned driving in the concept of future smart agriculture, so it has attracted widespread attention. In field operations, the application of path planning technology is mainly composed of two parts. First, path planning technology is used to statically plan the operation path from a global perspective; second, for emergency events such as small obstacles, dynamic, real-time local path planning can be achieved based on sensor technology, automatic control technology, and other technologies. At present, much research focuses on the latter, but there are few studies on CPP, and the research depth is insufficient. In the agricultural system, environmental factors and agronomic requirements are necessary factors for agricultural machinery operations, so the application of CPP in agricultural field production is targeted, practical, and complex. In order to complete an agricultural field operation, finding the optimal path to cover the entire field is a very difficult mathematical or algorithmic problem. According to current research, there is no exact evaluation standard to measure the advantages and disadvantages of the coverage path planning algorithm [5]. For example, in the study of two-dimensional farmland CPP, Oksanen and Visala [6], Zuo et al. [7], and Jin and Tang [8] all used the unit decomposition method to study the CPP problem of complex farmland in Finland, China, and the United States. Jensen et al. [9] studied the cooperative operation mode of transport units and harvesting units in the process of combined harvesting and studied the planning of internal field coverage path and the scheduling between different fields under this mode. Hameed [10–12] engaged in optimization research of CPP problems from the perspective of minimum overlap of operating area, minimum cost of nonworking path, and the presence of obstacles in the field, and developed specific and feasible planning algorithms. In addition, in terms of the details of the two-dimensional farmland CPP algorithm, Jin and Tang [8] and Meng et al. [13], respectively, analysed the cost of various headland turning methods and turning type decisions. Therefore, considering the actual operation situation and operation requirements from different perspectives, the planning results obtained are only a certain aspect of field operations to achieve the optimization of the two-dimensional farmland CPP scheme. Compared with 2D plane farmland, 3D terrain farmland has a more complex field operation environment, and it has become a major difficulty in agricultural CPP research. Different scholars have in-depth thoughts on the problem of 3D terrain CPP from different angles. Hameed et al. [14, 15] first studied the problem of large-scale farmland CPP with three-dimensional terrain based on a genetic algorithm from the perspective of energy consumption and then proposed a “side-to-side,” three-dimensional coverage method for the problem of skips/overlaps of the operating area by agricultural machinery. Both Jin’s team and Dogru’s team [16, 17] divided the three-dimensional farmland into plane areas and slope areas for zoning research. The difference is that Jin et al. analysed the optimal angle of the path covered in the field from the three perspectives of the cost of headland turning, the cost of soil flow, and the cost of the missing area, while Dogru et al. studied the optimal driving angle of the planned path based on energy consumption cost.

Field environment and terrain are the main influencing factors of field CPP. The farmland environment in hilly areas of China is unique: the fields are small and concentrated, and the fields are connected by field roads. Obviously, the 3D terrain farmland CPP scheme proposed by researchers in other regions is difficult to use in China, and the research on the 3D terrain CPP field in China is still in a nascent stage. Based on the background, the paper aims to develop a three-dimensional coverage path planning scheme that is compatible with the characteristics of farmland in hilly areas of China to meet the needs of autonomous operation of agricultural machinery in hilly fields. The contributions of this research mainly include the following three contents:(1)A mathematical model between the energy consumption of agricultural machinery and the driving direction angle on the three-dimensional terrain is constructed, and an exhaustive algorithm is used to search for the driving angle with the best energy consumption. Compared with the driving angle with the optimal path cost, the CPP obtained with the driving angle with the lowest energy consumption has little difference in path cost, but the energy consumption is significantly reduced.(2)The positions of the entrance and export nodes of each field are known, and the linear distance between the export node of any field and the entrance node of another field is taken as the heuristic function. The traversal sequence among fields was analysed by the genetic algorithm, and the connection between fields was realized.(3)Realized the visualization of the planned path and provided specific algorithms to realize the simulation of CPP scheme for specific farmland, which proved the feasibility and effectiveness of the scheme.

#### 2. Actual Needs and Specific Issues

The farmland area of hilly and mountainous areas in China accounts for a large proportion of the total cultivated land area. In view of the fact that domestic agriculture is subject to objective factors, such as the agricultural system and environmental conditions, farmland in China’s hilly areas has gradually developed the characteristics of small field areas and densely distributed fields. These characteristics bring challenges to intelligent operations and even mechanized operations. Therefore, in order to introduce the concept of autonomous driving in field operations in hilly and mountainous areas, 3D terrain static CPP technology is essential, and the technology is more difficult to implement than planar farmland CPP technology. The main difficulties include: (1) a series of problems caused by elevation in 3D terrain farmland to path planning technology need to be considered and (2) the obvious characteristics of farmland in hilly areas in China make it difficult for mechanized and intelligent operations.

Our research plan mainly considers the application of CPP technology from the perspective of energy consumption. At present, energy consumption in many fields has become a crucial factor that must be considered in research and development work [18, 19], and agricultural production is even more focused on energy consumption. Agricultural mechanization in China follows the development direction of green agriculture and precision agriculture. However, when working in three-dimensional terrain, it is inevitable to have to consider energy consumption because whether driving uphill or downhill, machinery will consume additional energy. If we ignore this aspect, it will cause the decrease of mechanical operation efficiency and the increase of energy consumption, which will increase the cost of mechanized operation for farmers. Therefore, it is reasonable and positive to evaluate the planned path in the field from the perspective of energy consumption.

#### 3. Methods

##### 3.1. Principle

In order to better describe the proposed scheme, we herein will make a series of reasonable idealization assumptions based on the characteristics of the operation: (1) assume that the farmland is located on a hilly slope with a slope of . (2) The plan will build a working area, which contains a number of irregularly distributed, small field blocks, and the field blocks are connected by field roads. (3) The surface of the farmland is linear; that is, the edge of the cross section at any angle is linear. (4) The contact between the surface of the field block and the wheel surface remains stable—that is, the rolling friction coefficient remains constant, and . (5) In the process of constructing the energy cost function, the energy consumption of the agricultural machinery in the headland turning area was ignored.

The specific algorithm process of farmland coverage path planning is shown in Figure 1. First, the obtained field boundary data and DEM data are visualized, and, at the same time, the selection of the headland turning type is performed according to the headland width information provided by the data. Then, the energy evaluation model is built and the optimal driving angle is searched based on the model. Then, the path is visualized and the planned path is analysed. Finally, the operation path planning in each field is completed in turn. After the internal path planning of each field block is completed, the traversal order of each field block operation is sorted, and a genetic algorithm is used to search the traversal order with the lowest path cost. Therefore, the scheme mainly solves three problems:(1)Farmland traversal sequence planning composed of multifield blocks(2)Single-field CPP(3)Visualizing the path of planning

##### 3.2. Single-Field Coverage Path Planning Based on Energy Consumption Model

###### 3.2.1. Explanation of Angle Relationship

The first parameter to deal with when building a three-dimensional terrain energy model is slope. The reason why three-dimensional terrain farmland is more difficult to design a path planning algorithm forthan two-dimensional farmland is the existence of slope. The inclination of agricultural equipment in the direction of field operation is different from the slope of 3D terrain. In actual operation, the relationship between the inclination and the slope of the driving direction can be known from

The sloping angle of the driving direction is simplified to obtainwhere = the slope angle; = the driving direction angle; the angle between the farmland boundary and the horizontal direction; = the angle between the working direction and the farmland boundary; and = the inclination angle of the working direction (Figure 2).

###### 3.2.2. Analysis of Unit Path Energy Model in Straight Line Sections

In the existing hypothesis, the surface of the farmland is linear. That is, the edge of the cross section at any angle is linear. The linearity of the field surface does not mean that the working inclination angle remains unchanged during the up-/down-slope movement, but the working inclination angle changes with the change of the slope angle . The farmland three-dimensional structure model constructed by DEM data has been linearized on the farmland surface. Therefore, a section of the path surface driven at an angle in simulation research is shown in Figure 3. When describing a path, the unit path is taken as the research object, and each unit path is assigned three parameters: the operation angle of the unit section, the path length of the unit section, and the driving force of the unit section. According to these three parameters, the energy consumption of each cell path is obtained.

Assuming that the two nodes of a unit path are and , respectively, the slope angle of the unit section of the unit path is calculated by the following formula:

Therefore, the working inclination of the unit path is

Euclidean distance is used to calculate the length of the unit path, which is formula (6):

When equipment is operating in the actual operating area, it can be divided into an up-slope operation stage () and a down-slope operation stage () according to the slope. When , the mobile device keeps moving uphill. The driving force of mobile devices in the uphill process is calculated as formula (4) [20]:where = driving force; = rolling friction; = air resistance; = slope resistance; and = acceleration resistance.

In formula (6), due to the low speed of field operation in hilly fields, air resistance is negligible, making . In addition, the operating equipment completes the working process and the turning process at two different speed values, so there is an acceleration/deceleration transition stage between the working process and the turning process, but this stage can be completed in a short time, so this stage is incorporated into the uniform speed operation stage, making . Therefore, the force exerted on the mobile device during the uphill movement can be simplified as follows:

The specific force analysis can be seen in Figure 4, wherewhere = rolling friction coefficient; (new tire) or (old tire); and total mass of mobile device.

Slope resistance is derived from the component of the mobile device’s gravity on the slope, so

According to equations (4), (7), (8), and (9), it can be obtained that

Similarly, in the process of downhill, the driving force of mobile devices is expressed as

Then, the unit segment driving force is

The power consumption of each unit path is calculated according to , and the energy consumption model of the unit path is

The example given in Figure 3 shows a complete path in the actual operation area of the field. Every two adjacent nodes are connected into a unit path, and several unit paths are connected to obtain a path. Several paths are connected through the turn of the ground to obtain complete coverage planning paths in the field. There are several paths in the actual operation area of the field block, so the energy consumption model based on the unit path can obtain the total power consumption of all paths in the actual operation area of the field block:

##### 3.3. Selection of Headland Turn Mode

The headland turning method is determined by the two parameters of the headland width and the minimum turning radius of the agricultural machine. There has been much research on the selection method of the headland turn, the path cost calculation method, and the path generation method [8, 13, 21, 22]. Jin and Tang [8] studied the decision-making and path cost calculation of several common ground turning modes, including “flat,” “*U*,” “light bulb,” and ”fishtail.” Figure 5 shows the decision-making model of headland turning based on our research results. The path costs of different turning methods are different. In [8, 13], the calculation method of the path costs of the turning process was proposed. Based on many studies, formula (15) can be obtained, which is the path cost of a single turning process:where = operating width; = angle between operating direction and farmland boundary; minimum turning radius; single turning path length; and headland width.

##### 3.4. Research on Field Traversal Sequence Based on Genetic Algorithm

When the internal CPP of each field block is completed, the location of the entrance and export nodes of each field block are known, and the optimal path that traverses each field block without duplication is searched based on the known condition of the entrance and export node locations. At this time, the problem can be regarded as a traditional TSP problem, and GA is an ideal way to solve the TSP problem [23], in which the selection of heuristic function is crucial [24]. The positions of the entrance and export nodes of each field are known, and the linear distance between the export node of any field and the entrance node of another field is taken as the cost to calculate the total cost required to traverse each plot, so as to optimize the traversal order. The steps to solve this problem with the GA algorithm are as follows: Step 1: encode genes (field block number and entrance and exit number) and initialize required parameters, where the population number is set to 100, the number of chromosome genes (field number) is 9, crossover probability is 0.9, and mutation probability is 0.1. Step 2: select the fitness function and judge the fitness of each chromosome. Because the import and export nodes of any field block have been determined, each chromosome (random arrangement of fields based on known import and export locations) can calculate the total cost based on the straight line distance between the exit of the front field block and the entrance of the back field block, and take the inverse of the total cost as the fitness function. Step 3: according to the fitness, the Roulette method is used to select the chromosomes, and the selected chromosomes are crossed and mutated to generate a new population. Step 4: continue evolution of new populations according to Step 2. Step 5: iteration termination principle. When the maximum number of iterations is reached or the fitness no longer changes, the algorithm terminates.

The process of the genetic algorithm is shown in Figure 6.

##### 3.5. Algorithm Implementation

The above content describes the core content of the scheme, including energy consumption cost function, optimization of the field traversal order, and decision of the headland turning method. The research program was to design a complete path planning in an operation area from the perspective of energy consumption. For a given operation area, the specific algorithm flow is as follows: Input: (boundary of each subfield and internal node DEM data file), (headland width), (minimum turning radius), (operating width), (total agricultural machinery mass), (driving angle search step), and (reference coordinate origin). Output: the resultant data and correlation graph of the optimal driving angle, energy consumption cost, and path cost of each field. Step 1: input the data file FF, set working parameters, and complete the visualization of farmland data. Step 2: the reference origin, , is selected, and the collected boundary data points and elevation data points within the field block are converted from latitude and longitude coordinates to rectangular coordinates. Step 3: according to the function , each field is optimized to obtain the driving angle with the energy optimal. Set the driving direction angle, start from , search in order according to the step size , calculate the energy cost and path cost of each angle according to the cost model, store them in the variable , and search for the most based on the energy cost search optimal driving angle . Step 4: according to the two parameters of the width of the headland and the minimum turning radius , the function is called to select the turning mode of the headland inside the field. Step 5: the function is used to complete the visualization of the internal planning path results of each field block, and the entrance and export position data of each field block are recorded, and the data are stored in two variables, , and . Step 6: based on the method described in Section 3, calculate the path cost value between any two fields A and B, search for the optimal traversal order of the path cost by genetic algorithm, and finally output the search result, that is, the traversal order number. Step 7: visualize the traversal path, complete the overall path planning, and the algorithm ends.

#### 4. Analysis of Simulation Results

In order to verify the feasibility and effectiveness of the studied algorithm, a series of simulation tests were conducted using real farmland data and field operation parameters. The simulation experiment was conducted in the MATLAB 2019a programming environment on a Windows 10 Intel (R) Core (TM) i5-1035 PC.

In 2D farmland, the energy consumption of agricultural machinery operations is related to the length of the path that the job travels, so path cost is a common indicator to solve the CPP problem of two-dimensional farmland. However, in the 3D CPP, the energy consumption of operations is not only affected by the length of the path but also closely related to the slope and elevation. Therefore, it is necessary to construct an energy consumption model of agricultural machinery in the 3D farmland operation process, which will be used to solve the 3D CPP problem. In order to reflect the advantages of the energy consumption model in solving the 3D CPP problem, the path cost corresponding to each angle will be recorded in the variable during the experiment. In this way, it is possible to evaluate the advantages of using energy consumption cost as an indicator to complete the CPP of 3D terrain farmland by comparing with the path cost.

The simulation analysis experiment takes Farmland A as the object of simulation, the hillside where the farmland is located is facing , the satellite image of farmland is shown in Figure 7, and the farmland data parameters are shown in Table 1. Figure 7 shows the shape and location of the farmland, and the shape of each field is simple. The lengths of fields 2, 4, 8, and 9 are narrow. The long axis of field block 2 is perpendicular to the slope direction, whereas the long axes of fields 4, 8, and 9 are parallel to the slope direction. The remaining fields are not different in length and width. Farmland A consists of nine fields with an area of no more than , and the sum of each field area is 20025.4467 m^{2}, of which the largest elevation difference is in field block 8, reaching . The simulation test takes the developed hilly mountain tractor autonomous task equipment as the simulation operation vehicle, and the field operation parameters are shown in Table 2.

The simulation results of the CPP of fields 1∼9 are shown in Figure 8, and the simulation data of each field are shown in Table 3. Figure 8 shows that the driving directions of the optimal energy consumption paths of each field tend to be similar, and a feature also reflected in the data (Table 3). The optimal driving angle for energy consumption is concentrated at 175° and 355°, which are opposite directions. It is known that the direction of the hillside where the farmland is located is 80°. The orientation of the hillside fields has an important influence on the optimal energy drive angle, and the two have a vertical relationship.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(g)**

**(h)**

**(i)**

When studying the path planning results of specific fields, some interesting phenomena will be found. Figures 8(h) and 8(i) are the planning results of the field blocks 8 and 9, respectively. The two fields are narrow in shape, and their long axes are parallel to the slope. Their areas are and , respectively, and the respective optimal energy consumption values are and . The areas of field blocks 6 and 5 are slightly larger than those of field blocks 8 and 9, respectively, and their optimal energy consumption values are and , respectively, a smaller values than those of field blocks 8 and 9. Therefore, the shape of a three-dimensional landform has a certain influence on the energy consumption: when the shape of the field is narrow and the long axis is parallel to the slope, the narrow terrain will cause more energy consumption.

In the process of processing the variable that stores the result data, the relationship between the route cost and the driving angle (Figure 9) and the relationship between the energy cost and the driving angle (Figure 9) can be obtained. It can be found from the resultant data of each field coverage path shown in Figure 9 that there is a sinusoidal relationship between energy consumption cost and driving angle for each field coverage path. The conclusions obtained are mutually verified with the correctness of the energy consumption model proposed in Section 3.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(g)**

**(h)**

**(i)**

According to the information shown in Figure 9 and the data in Table 3, in terms of energy consumption, the path obtained by searching energy consumption cost is better than the path obtained by searching energy consumption cost, among which Field 8 can reduce energy consumption by 42.46%. Overall, the energy consumption model can reduce energy consumption by 17.4%. Besides, as shown in Figure 9, it can be found that the path costs of the planned paths at different travel angles do not vary significantly, so it is more valuable to use energy consumption cost as the evaluation scale in 3D terrain.

After the completion of the path planning results for each field, the complete CPP results in the operation area are shown in Figure 10, in which the sequence of the fields obtained by genetic algorithm optimization is . The node coordinates of each field cover path planning for the field access are shown in Table 4 in which the coordinate data are transformed into coordinates of the rectangular coordinate system with as the reference origin. In the test results, the optimal coverage path of energy consumption for nine fields was successfully planned, and the orderly connection of each field was realized. It can be considered that the proposed scheme is feasible, and the required operation target can be achieved under certain conditions.

#### 5. Conclusion and Future Research

The innovation of the scheme is mainly realized in the following three aspects: a path planning algorithm is developed to cover the operation area of nonstandard farmland in hilly areas of China, which are characterized by small areas, dense distributions, and irregular patterns. The algorithm uses the energy consumption model to plan the covering path of a single field. According to the characteristics of the irregular distribution of each field in the working area, based on the known location of entrance and exit of each field, the order of traversing each field was optimized by the genetic algorithm.

The simulation experiment is carried out by selecting actual farmland and actual operation parameters, and the algorithm proposed in this paper is verified, and its performance is evaluated. The experimental results show that the developed algorithm can realize the coverage path planning of farmland with multiple subfields. The algorithm also records the path cost data of different driving angles. Compared with the path planned by the optimal energy consumption and path cost, the path obtained by the former is better in terms of energy consumption, while the path cost differs little. Therefore, taking energy consumption as an evaluation index is more suitable for path planning of 3D terrain. Besides, based on the optimal energy consumption of each field, the connection between multiple fields in the operation area was effectively completed.

The research in this article has important guiding significance for agricultural machinery field operations in hilly areas of China. Also, with the Chinese government increasing policy investment in the agricultural mechanization transformation of hilly and mountainous districts, the research can contribute to the field of intelligence of hilly farm machinery. It can be seen from the selected simulated farmland that the current study has a better effect on dealing with farmland with a simpler field environment and shape. However, the farmland environment is complex, and the planning scheme still needs to be improved in detail when dealing with complex farmland (such as obstacles and complex shapes). The comprehensiveness and complexity of agriculture is a normal phenomenon. Besides, the effective coordination between the job requirements and the job environment is also one of the directions of CPP’s in-depth research. On the one hand, according to the actual power output of farm machinery in the field operation process, the energy consumption model is optimized to make the model more accurate and reliable; on the other hand, specific operational requirements (such as unloading of harvesting operations and loading of seeding/fertilization operations) will be considered in the CPP scheme, which will involve multimachine collaborative scheduling.

#### Data Availability

CPP simulation data based on MATLAB used to support the findings of this study are included within the supplementary information files. The simulation data used to support the results of this study have not been provided because of project requirements.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

#### Acknowledgments

This work was supported by the National Key Research and Development Plan, Key Project of “Intelligent Agricultural Machinery Equipment” (no. 2016YFD0700405).

#### Supplementary Materials

The data on the experimental farmland A used in the article are provided. This data file is used in the simulation experiment. A complete algorithm simulation program based on MATLAB is provided.* (Supplementary Materials)*