## 2 Autonomous Driving Path-Generation Algorithm for a Ridge-Forming Robot
### Autonomous Driving Path-Generation Algorithm
#### 2.2.2 Field Boundary Definition  
The second step in the autonomous driving path-generation algorithm is to define the outer- and the inner-field boundary, to set the inner work area and the headland area. The method used to define the outer- and the inner-field boundary in this study is to calculate the north-east-down (NED) coordinates of the vertices of the boundary and the parameters of the equation of a straight line of the boundary lines. For this, first, since the inputted field parameters which are the coordinates of the vertices constituting the field boundary are geodetic coordinates on an ellipsoid, they are converted to NED coordinates based on the coordinates of the first field boundary point, to convert them to coordinates on a plane. After completing the coordinate transformation, starting from the first point of the input field boundary, the two points of the line segment constituting the field in a clockwise direction and the calculated slope (_m_) and y-intercept (_c_) of the straight line are defined, which are the parameters of the equation of a straight line. When calculating the parameters of the equation of a straight line, the x and y axes are, respectively, the same as the east and north axes in the NED coordinate system. The NED coordinates of the vertices of the outer boundary and the parameters of the equation of the straight line for the line segments constituting the outer boundary are stored. The inner boundary of the field is the inner work area of the field and is defined by excluding the headland area, which is the area where the robot turns from the area created as the external boundary of the field. The internal border and boundary points of the field are created by calculating the equation of a straight line, that is, the width of the headland area (_d_) away from the external border of the field, and then calculating the intersection  
Figure 1: Process for the autonomous driving path generation. point using the straight-line equation. Since the ridge-forming robot used in this study is a crawler-type robot, the rotation method in the headland area is set for in situ rotation to expand the ridge-forming area. Thus, the width of the headland area is defined as the sum of the length of the robot and the agricultural implement. The coordinates of the vertices of the inner-field boundary are defined by calculating the intersection between adjacent inner boundary lines after calculating the equation of the straight line of the internal boundary, separated by the width of the headland area from each external boundary line constituting the outer-field boundary. The process of calculating the equation of the straight line of the internal boundary line that is the width of the headland area away from the external boundary line to define the internal boundary line and boundary point is as follows. First, two internal boundary candidate lines are created that are the same as the slope of the external boundary line, and are separated by the width of the headland area in the direction orthogonal to the external boundary line, as illustrated in Figure 2a. The slope of the equation of the straight line of the created two internal boundary candidate lines is the same as the slope of the straight line of the external boundary line (\(m_{i}\)), and the y-intercept of the two created internal boundary candidate lines is calculated by:  
\[b_{i,1} =b_{i}+d_{h}\times\sqrt{{m_{i}}^{2}+1} \tag{1}\] \[b_{i,2} =b_{i}-d_{h}\times\sqrt{{m_{i}}^{2}+1}\]  
where \(b_{i,1}\) and \(b_{i,2}\) are the y-intercept of the two created internal boundary candidate lines, \(b_{i}\) is the y-intercept of the straight line of the outer boundary line, \(d_{h}\) is the width of the headland area, and \(m_{i}\) is the slope of the straight line of the outer boundary line. Next, among the two internal boundary candidate lines, the internal boundary line that passes through the interior of the external boundary of the field is selected, as illustrated in Figure 2b.