## 4 Coverage Path Planning
### Coverage Path Planning for Special Terrain
#### 4.2.2 Coverage Method  
The method for covering 3D special terrain typically involves finding a traversal direction that minimizes energy consumption for the operation, but this approach does not significantly reduce energy consumption. Based on an analysis of energy consumption, this paper proposes a coverage method aimed at optimizing energy consumption in special terrain. To minimize the energy consumption of the robot during traversal, the robot should select the grid with the lowest energy cost as the next target grid, while also considering the time cost associated with robot steering. A cost function, denoted as \(C\), is proposed  
Figure 6: Common mulching methods.  
to describe the cost of moving the robot to different grids. The function \(C\) is calculated as follows:  
\[C=K_{1}E_{1}+K_{2}E_{2}+K_{3}A \tag{9}\]  
In Equation (9), \(K_{1}\) is the cost coefficient of the path length, \(K_{2}\) is the cost coefficient of the path elevation, \(K_{3}\) is the cost coefficient of the steering, and A is the angle at which the direction of travel changes as the robot moves to the next grid. In the traversal process, the robot first needs to calculate the function C value of the eight neighboring grids around it and selects the one with the smallest C value that has not been covered to be covered. The size of the three cost coefficients \(K_{1},~{}K_{2},~{}K_{3}\) represents the influence of path length, elevation difference, and steering angle in the decision-making process when the robot selects the next grid. For different terrain, the characteristics of the operating area can be set to different values to improve the applicability of the algorithm. For example, if the operating area of the terrain undulation height is not too large, the \(K_{1}\) and \(K_{3}\) can be appropriately increased so that the total length of the path and the number of steering maneuvers is reduced; however, when the operating area has a greater undulation height, the value of \(K_{2}\) is increased, so that the robot's path elevation difference is reduced, which will cause the path length and the number of steering maneuvers to increase, but the overall energy consumption of the whole process will be optimized. The Algorithm 1 is the coverage path planning algorithm, where the input is the map information of the region and the starting point of the path, and the output is the covering path; function1 in line 4 serves to find the uncovered neighboring raster of current in map, and function2 in line 8 serves to compute the cost of the movement from current to around (i) using Equation (9).  
```
Input: Map of special terrain region map, the current point start Output: Coverage paths path
1: path () \(\leftarrow\) {}, current \(\leftarrow\) {}, around () \(\leftarrow\) {}
2: path(end+1) \(\leftarrow\) start, current \(\leftarrow\) start
3:while true
4: around () \(\leftarrow\) function1 (current, map)
5:if around () is not empty
6: length \(\leftarrow\) length of around ()
7:for i = 1 : length
8: cost (i) \(\leftarrow\) function2(current, around (i))
9: end
10: min_cost \(\leftarrow\) cost (1)
11: min_index = 1
12:for i = 1 : length
13: if cost (i) < = min_cost
14: min_cost \(\leftarrow\) cost (i)
15: min_index = i
16: end
17: end
18: path(end+1) \(\leftarrow\) around (i), current \(\leftarrow\)-around (i)
19: mark around (i) as covered in the map
20:else
21: escape the dead zone
22: end
23: around () \(\leftarrow\) {}
24: if map is all covered
25: break
26: end
27:end
```  
**Algorithm 1**