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 ( and y-intercept () 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 () away from the external border of the field, and then calculating the intersection 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 (
), and the y-intercept of the two created internal boundary candidate lines is calculated by:
where
and
are the y-intercept of the two created internal boundary candidate lines,
is the y-intercept of the straight line of the outer boundary line,
is the width of the headland area, and
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. To do this, the intersection of two external boundary lines connected to the currently selected external boundary line and the two internal boundary candidate lines are calculated. And, when intersections are contained in two external boundary lines connected to the currently selected external boundary line, the slope and y-intercept of the internal boundary line used in the calculation of the intersection points are saved. When the calculation of the slope and y-intercept of the internal boundary line for each external boundary line is completed, the intersection between the adjacent internal boundary lines is calculated and defined as the coordinates of the vertices of the inner-field boundary, as illustrated in
Figure 2c.
2.2.3. Working-Line Generation
The working line refers to a set of line segments in which ridge-forming work is performed. It is generated in the inner-field boundary and the headland area, respectively. The process of generating the working line in the inner-field boundary consists of four steps: the definition of a minimum bounding rectangle (MBR), the generation of candidate sets consisting of line segments within the MBR, the generation of candidate sets consisting of line segments within the inner-field boundary, and the final selection of a set of line segments.
The first step is to produce an MBR, which is a rectangle of the minimum area including the set of the vertices of the inner-field boundary. Since this study generates line segments on the plane, the MBR of the inner-field boundary is defined as using the minimum North coordinate (
), the maximum North coordinate (
), the minimum East coordinate (
), and the maximum East coordinate (
) among the coordinates of the vertices of the inner-field boundary. The coordinate of the vertices of the MBR of the inner-field boundary (
is defined by:
For the second step, candidate sets consisting of line segments within the MBR are generated according to the slope of the line segment by considering the slope angle of the line segments of the inner-field boundary, since the line segment may be generated in various directions according to the shape of the field boundary. The method for generating candidate sets consisting of line segments within the MBR is as follows.
First, the nearest vertex to the origin of the NED coordinate system among the vertices of the MBR of the inner-field boundary is selected. Then the slope angle is calculated for each of the two-line segments of the MBR including the MBR vertex nearest to the origin of the NED coordinate system. The calculated slope angle for each of the two-line segments of the MBR is the maximum and minimum range of the slope angle used to generate work line segments, and a set of slope angles is defined at one-degree intervals within the range of the slope angles. For each of the generated slope angles, the slope and y-intercept for the straight-line candidates are calculated according to the slope angle as follows.
The slope of the straight line is defined using the slope angle as:
where
is the slope of the straight line according to the
i-th slope angle and
is the
i-th slope angle.
The y-intercept (
) of the straight line with the slope (
) and passing through the MBR vertex nearest to the origin of the NED coordinate system is calculated by:
where
and
are the North and East coordinates of the MBR vertex nearest to the origin of the NED coordinate system.
A straight line with the slope (
) is generated by increasing the y-intercept (
) of the straight line in a positive direction by the width of the ridge (
). If there are two intersections between the straight line and the MBR boundary, the slope and y-intercept for the straight line are stored. The increments in the positive direction are repeated until two intersections no longer appear with the MBR boundary.
where
is a value that starts from 0 and increases by 1 until two intersections no longer appear within the MBR boundary.
Using the above equation, a straight line is generated in a negative direction by the width of the ridge, and if there are two intersections between the straight line and the MBR boundary, the slope and y-intercept for the straight line are stored. In the above equation, is a value that starts from −1 and increases by −1; if two intersections do not appear, the above process is repeated for the next slope angle.
The third step is to generate candidate sets consisting of work line segments that meet the inner-field boundary, using a set of the slopes and y-intercepts of straight lines intersecting the MBR boundary for each slope angle of the straight line. If there are two intersections between the inner boundary and the straight line and the distance of the intersection is longer than twice the length of the ridge-forming robot, the coordinates of the intersection are stored as the coordinates of the two endpoints of the working line segment candidates.
The last step for the work path generation in the inner-field boundary is to select one working line segment group from among the working line segment candidate groups generated for each slope angle. To maximize the ridge-forming area, the total distance of the working line segment candidate groups generated for each slope angle is calculated, and the working line segment candidate group with the longest total distance is selected as the final inner working line segments in the inner-field boundary.
The method of generating outer working line segments within the headland area is as follows. The outer working line segments within the headland area are generated sequentially clockwise along the field boundary starting from the vicinity of the first vertex of the input field boundary points. Therefore, first, in the same way as the method of defining the inner-field boundary, outer working line segments that are half of the width of the headland area away from the external border of the field are created. Next, the length of the outer working line segments is adjusted considering the size of the robot so that the robot can move to a nearby outer working line segment within the headland area by rotating in place.
2.2.4. Waypoints Generation
In this step, autonomous driving paths for ridge-forming work are generated according to autonomous driving operation scenarios using the inner and outer working line segments generated in the working line generation step. An autonomous driving path is a series of waypoints that are sequential points to which the robot must drive, and location coordinates and work methods at those waypoints are described. In this study, the information included in a waypoint included a waypoint number, waypoint coordinates (latitude, longitude), and waypoint type. The waypoint type is defined by dividing it into a starting waypoint, straight waypoint, turning waypoint, work-starting waypoint, work-ending waypoint, and ending waypoint, considering the operation of a ridge-forming robot. In this study the autonomous driving scenarios for an autonomous crawler-type ridge-forming robot were divided into three types: autonomous ridge-forming in the inner field, autonomous driving for returning to the starting point, and autonomous ridge-forming in the headland area. Therefore, the proposed algorithm generates waypoints corresponding to each autonomous driving scenario.
The first autonomous driving scenario, autonomous ridge-forming in the inner field, starts from the endpoint of the inner working line segment, which is the nearest to the coordinates of the first outer-field boundary point, and sequentially drives along the inner working line segments that are near to each other, to perform autonomous ridge-forming work. The method of generating waypoints for the scenario of autonomous ridge-forming in the inner field is as follows.
To define the reference point for generating waypoints, the inner working line segment closest to the first outer-field boundary point is extracted. Then, among the two endpoints of the extracted inner working line, the endpoint nearest to the first outer-field boundary point is defined as the reference point. Next, the distance between each inner working line segment and the reference point is calculated and the inner working line segments are sorted in order of the closest distance to the reference point.
To be sure the shortest distance is driven via all inner working line segments starting from the reference point, the two endpoints of each inner working line segment are defined as the starting or ending point, respectively. Next, four waypoints for each inner working segment are created by using the coordinates of the two endpoints of each inner working line segment, the length of the robot driving platform, and the length of the attached implement, considering the driving and working operations. The four waypoints created for each inner working segment are a waypoint located outside the inner boundary of the field to move to the waypoint that starts the ridge-forming operation, a waypoint to start the ridge-forming operation, a waypoint to end the ridge-forming operation, and a waypoint to move to the next inner working line. The coordinates of the waypoint are calculated to be located outside the starting point of the inner working line segment using the length of the inner working line segment and the length of the robot using the external section formula. The coordinates of the waypoint are calculated using the following formula, where
and
, which are the ratio values in the external section formula, are set as the length of the robot and the sum of the length of the robot and the length of the inner working line segment, respectively.
where
are the coordinates of the external dividing point,
are the coordinates of the starting point of the inner working line segment,
are the coordinates of the ending point of the inner working line segment, and
and
are the ratio values in which the external dividing point divides the line externally.
The implement is attached to the rear of the robot driving platform and the inner working line is where the ridge is formed, so a waypoint to start the ridge-forming operation is located on or within the inner working line. Therefore, the coordinates of the waypoint to start the ridge-forming operation are calculated using the following internal section formula, with
and
, which are the ratio values in the internal section formula, set to the sum of the half-length of the robot and the length of the implement and the length of the inner working line segment minus the sum of the half-length of the robot and the length of the implement, respectively.
where
are the coordinates of the internal dividing point,
are the coordinates of the starting point of the inner working line segment,
are the coordinates of the ending point of the inner working line segment, and
and
are the ratio values at which the internal dividing point divides the line internally.
The waypoint to end the ridge-forming operation, when the operation for the ridge-forming line is completed, is located outside of the ending point of the inner working line segments. The coordinates of the waypoint to end the ridge-forming operation are calculated using Equation (7) by setting the ratio values and to the sum of the half-length of the robot, the length of the implement, and the length of the inner working line segment as well as the sum of the half-length of the robot and the length of the implement.
A waypoint to move to the next inner working line is a point where the robot rotates in place to move near the next straight line. When rotating in place, track slip may occur, so taking this into account, the coordinates of the waypoint are calculated to be offset a certain way away from the waypoint to end the ridge-forming operation. The method for calculating the coordinates of a waypoint to move to the next inner working line is the same as that for a waypoint to end the ridge-forming operation, but the ratio values are set by adding an offset to the ratio values defined when calculating the coordinates of a waypoint to end the ridge-forming operation. However, for the last inner working line segment, the coordinates of a waypoint to move to the next inner working line are not calculated.
Once the task of creating four waypoints for each inner working line segment is completed, the coordinates of all waypoints expressed in the NED coordinate system are converted to geodetic coordinates. Then the geodetic coordinates of the waypoints are stored sequentially in the order in which the coordinates of the waypoints were calculated. The waypoint types of all generated waypoints are defined as follows.
The type of waypoint located outside the inner boundary of the field in order to move to the waypoint for starting the ridge-forming operation of the first inner working line segment is set as the starting point. The type of waypoint located outside the inner boundary of the field in order to move to the waypoint for starting the ridge-forming operation of the other inner working line segment is set as a turning point. The type of a waypoint to start the ridge-forming operation and a waypoint to end the ridge-forming operation of all the inner working line segments are set as the work-starting point and the work-ending point, respectively. The type of waypoint to move to the next inner working line is set as a turning point. Since the currently saved waypoint has no ending point, the type of waypoint to end the ridge-forming operation of the last inner working line segments is reset to the ending point.
The second autonomous driving scenario, autonomous driving for returning to the starting point in the headland area, starts from the last waypoint for autonomous ridge-forming in the inner field and sequentially drives along the outer working line segments to arrive at the endpoint of the outer working line segment nearest to the first outer-field boundary point. To create waypoints corresponding to the second autonomous driving scenario, first of all, the outer working line segment with the nearest distance from the last waypoint for autonomous ridge-forming in the inner field is selected, and the coordinates of a point within the selected line segment with the shortest distance from the last waypoint for autonomous ridge-forming in the inner field are calculated. And the coordinates of the last waypoint for autonomous ridge-forming in the inner field and the coordinates of a point within the selected line segment with the shortest distance are stored on waypoints.
Since the endpoints of the outer working line segments are connected, the total distance for each direction of rotation is calculated by moving clockwise and counterclockwise from the point within the selected line segment with the shortest distance from the last waypoint for autonomous ridge-forming in the inner field to the endpoint of the outer working line segment nearest to the first outer-field boundary point, respectively. A list of a series of points consisting of an endpoint of outer working line segments moving to the starting point with the shortest distance is extracted, and the coordinates are stored in waypoints. The coordinates of all waypoints for the second autonomous driving scenario expressed in the NED coordinate system are converted to geodetic coordinates. The waypoint type for the first scenario and the waypoints are specified as the starting point and ending point, respectively. All waypoints except the first and last waypoints are points where the robot changes driving direction, so the waypoint type is set to turning waypoints.
The third autonomous driving scenario, autonomous ridge-forming in the headland area, starts from the endpoint of the outer working line segments, which is the nearest to the coordinates of the first outer-field boundary point, and sequentially drives along the outer working line segments that are near to each other to perform autonomous ridge-forming work. Since the outer working line segments are connected, we find the endpoint of the outer working line segments nearest the first outer-field boundary point, and then arrange the outer working line segments so that they can be connected sequentially in a clockwise direction.
Next, the endpoints of each outer working line segment are defined as the starting or ending points. For each outer working line segment, the following are defined: a waypoint located outside the inner boundary of the field to move to the waypoint of starting the ridge-forming operation; a waypoint to start the ridge-forming operation; a waypoint to end the ridge-forming operation; and a waypoint to move to the next inner working line and calculate their coordinates. Each outer working line segment’s starting and ending points are set to a waypoint to start the ridge-forming operation and a waypoint to move to the next inner working line, respectively. The coordinates of a waypoint to start the ridge-forming operation, and a waypoint to end the ridge-forming operation for each outer working line segment, are calculated using Equation (7).
The ratio values for calculating the waypoint to start the ridge-forming operation are the sum of the half-length of the robot and the length of the implement and the length of the outer working line segment minus the sum of the half-length of the robot and the length of the implement, respectively. In addition, the ratio values for calculating the waypoint to end the ridge-forming operation are the length of the outer working line segment minus the sum of the half-length of the robot and the length of the implement and the sum of the half-length of the robot and the length of the implement, respectively. The type and coordinates of waypoints are defined, calculated, and saved in the same way as those using inner working line segments.