Metric Map Generation for Autonomous Field Operations

: Advanced systems for manned and/or agricultural vehicles—such as systems for auto-steering, navigation-adding, and autonomous route planning—require new capabilities in terms of the internal representation for the autonomous system of the working space; that is, the generation of a metric map that provides by numerical parameters any operation-related entity of the working space. In this paper, a real-time approach was developed for the generation of the field metric map, based on a row generation method (polygons-based geometry). The approach can deal with fields with or without in-field obstacles, where the generated field-work tracks can be either straight or curved. The functionality of the approach was demonstrated on 12 fields with different number of obstacles ranging from one to six. The test results showed that the computational times were in the range of 0.26–24.51 s. The presented tool brings a number of advancements on the process of generating a metric map for arable farming field operations, including the real-time generation feature, the potential to deal with multiple-obstacle areas, and the reduction in the overlapped area.


Introduction
Agriculture faces a range of social and environmental challenges, such as the growing demand for high-quality food products, climate change, and market globalization. Farmers are forced to reduce production cost while maximizing the quality of products in order to compete in the globalized market [1]. Machinery investment, maintenance, and operational usage are key parts of the production costs. In order to enhance machinery productivity and operational efficiency, and consequently to reduce production costs, increasing efforts are being contributed to the development of advanced operations management systems using advanced information technologies, automation, sensing systems, and actuating systems [2][3][4][5].
As part of these aforementioned efforts, a significant amount of research has been dedicated to the development of advanced algorithms or methods for automating operations optimization in arable farming. This has included various approaches for the improvement of the field efficiency of semi-automated operations (navigation-adding systems) or fully autonomous (field robots) operations, and these approaches include route planning and field area coverage [6][7][8][9][10][11][12][13][14][15][16][17][18]. However, the transition of field operations from manual operated operations to fully automated operations requires new functionalities of the developed operations optimisation systems.
To this direction, a significant amount of research has been dedicated to the development of advanced algorithms or methods for automating operations optimization in arable farming. This has included various approaches for the improvement of the efficiency of field automated (navigationadding systems) or autonomous (field robots) operations, such as route planning and field area coverage approaches [6][7][8][9][10][11][12][13][14][15][16][17][18]. However, the modification of the processes from conventional to fully automated operation requires new functionalities of the developing systems.
The execution of autonomous operations requires a "world representation", that is a geometrical representation of working space for the autonomous system. This usually includes the use or the generation of a metric map that provides by numerical parameters the representation of any operation-related entity of the working space. In the general mobile robotics case, this metric map could be either a Cartesian (geometrical) map or a grid-based map. However, in agricultural operations, due to the constrained vehicle traversal of the field (i.e., moving on pre-defined fieldwork tracks), all of the approaches regard the generation of a geometrical map. A number of methods have been introduced for the generation of geometrical representation of either simple convex or complex concave fields. For example, Palmer et al. (2003) generated predefined field-work tracks aiming to reduce the amount of overlapped and missed area [19]. Taïx et al. (2006) proposed algorithms to generate straight field-work tracks for field coverage both in the cases of convex or nonconvex fields without obstacles [20]. Algorithms for the generation of field representations for complex fields have been developed by Oksanen and Visala (2007), in which, firstly, complex fields were divided into simple trapezoid fields, then straight field-work tracks were generated, based on a calculated driving direction derived from the function of working width and turning time [21]. Hameed et al. (2010) presented a mathematically descripted method for the generation of field geometrical representations in real time for fields with or without obstacles using straight or curved field tracks [22]. Spekken et al. (2016) presented a method to generate patterns of fieldwork tracks in the form of curved polylines on sloping land to assess their susceptibility to water erosion [12]. Hameed et al. (2016) presented an approach for a 3D coverage map generation, where the 2D coverage map is projected through field terrain [23]. The selected test fields showed savings of skipped and overlapped areas in the range of 2%-14%. However, all methods have some limitations in terms of completeness. Tracks generated in the various methods only intersect with the inner boundary of the field or the outer boundary of obstacles, as shown Figure 1.a. It can be seen that following these generated field-work tracks by agricultural vehicles will lead to uncovered areas (yellow colored area). Therefore, in order to cover the entire field, these tracks have to be extended by some distance as shown in Figure 1.b. The process of tracks extension becomes complicated when a field comprises multiple obstacles.
To this end, in this paper a new algorithmic method for the generation of a metric map representing an agricultural field using headland field work pattern is presented. In this method, a row generation-based approach (polygons-based geometry) is implemented to eliminate the uncovered areas as illustrated in Figure 1. a. The generated fieldwork tracks can be either straight or curved field-work tracks for any complexity level of fields in terms of shape and number of in-field obstacles. It should be noted that the presented approach aims to provide partial improvements in the problem of metric map generation for field autonomous operation and not yet a complete solution. This is due to various limitations of the approach which are presented in the Discussion Section.

Methods
In this section, firstly, the applied geometric primitives are explained and defined in Section 2.1. Next, various geometric operators used for manipulation of geometric primitives are introduced in Section 2.2. Lastly, the procedures of generating field geometrical representation are presented in details in Section 2.3.  A polygon has one outer ring and zero or multiple inner rings { , … , }. The outer ring is oriented clockwise while an inner ring , ∈ {2, … , } is oriented counter-clockwise (see Figure  2.b). Following this orientation, the area to the right of the outer ring and the inner rings defines the interior (shaded part in Figure 2) of the polygon. Similarly, the area to the left of the rings is the exterior of the polygon. In our study, the field boundary is equivalent to the outer ring, the obstacle boundary is equivalent to an inner ring, and the field body (the operational area) is equivalent to the interior polygon area.

Geometric Primitives
Envelope. An envelope, , is a bounding rectangle that encloses a geometry ∈ { , , }. A given geometry can have multiple bounding rectangles with different orientation angle. The minimum bounding rectangle (as shown in Figure 3) has the smallest area among all the bounding rectangles. Figure 3. Example of an envelope of a polygon. This is the minimum bounding envelope.

Geometric Operators
Intersection ( ∩ ( , )). The intersection operator ∩ is used to find the overlapped area between two geometries Α and Β. The geometries can be line segments, polylines, rings or polygons. If is the intersection between Α and Β it satisfies that ⊆ A ∧ ⊆ B. Intersection examples are illustrated in Table 1 where the green marked geometry corresponds to the intersection between two examples of geometries Α and B.
Subtraction ( ( , )). The subtraction operator Δ determines a geometry , which is the difference between the two input geometries A and B. The subtracted geometry satisfies the condition that ⊆ A ∧ ⊈ and. Examples are given in Table 1. Note, that subtraction does not obey the commutative law (Δ (A, B) Δ (B, A)). Table 1. Illustration of intersection ∩ ( , ) and subtraction ( , ). Results of the operations are marked green.

Input geometries
Intersection ∩ ( , ) Subtraction ( , ) Offset (∥ ). The offset operator ∥ creates a geometry that is parallel to the input geometry ∈ { , , } at a specified distance . The distance can be either positive ( ) or negative ( ).
Examples of offset for a polygon, polyline and line segment are presented in Table 2. Table 2. Illustration of the offset operator for polygon, polyline and line segment with offset width . The direction of both lines is from bottom left to top right. The green lines and rings are the generated geometries by the offset operator ∥ .

Polygon offset
Polyline offset Line offset Buffer ( ). The buffer operator Π creates a polygon around the input line , which may be a line segment or a polyline. First, two parallel lines to both sides of at a specified distance are generated with the offset operator ∥ and ∥ , and then, these two lines are joined in the ends to compose the buffer polygon around . In the example in Figure 4, the black line is the input line and the green polygon is a buffer polygon. Projection (⊥ ( , )). The projection operator, ⊥, projects a point to a line or polyline and determines the projected point ′ on such that the line has the shortest distance to . Figure  5.a. illustrates how the points , , and are projected on the polyline = , . Note, that projects to two points on , and , since is equidistant to the line segments and in Figure 5.a. The projection point ′ can be either interior or exterior of , as illustrated in Figure 5.a, where the projection points , , and are interior to , while is exterior.
Point union (⨃({ })). The point union operator ⨃ takes an ordered set of points { } and generates a polyline consisting of line segments with end points in { }. In the context of this paper, the point union operator is always used along with the projection operator ⊥ to create a line segment or a polyline that links all the projection points and points of the original line that lie in between these projection points. This is illustrated in Figure 5

Boolean intersect ( & ( , ) ). The boolean intersect operator & is used to check if two geometries ,
intersect or not, i.e., if they share at least one point.

Metric Map Generaiton
In this section, the methods for generation of the geometrical representation of a field by using the aforementioned geometric primitives and operators are introduced.

Inputs
The input set required for the generation of the field metric map includes: • The boundary of the field area and the boundaries of the in-field obstacles, which are represented by a polygon, .

•
The number of headland passes ( ) for the main field and each obstacle.

•
The line ( ), which is used as reference line for generation of the parallel field-work tracks. can be either a straight-line segment or a polyline.

•
The operating width ( ). This is the effective operating width of the implement.

Metric Map Entities
The representation involves the generation of the following geometric entities: Headland passes: a headland pass is a peripheral path internally around the field boundary or externally of an obstacle. The headland area consists of the several headland passes and provides the required space for the machine turnings. The remaining field area excluding the (field and obstacle/s) headland areas and obstacle/s area/s, is called the field body area.
Field-work tracks: In order to cover the entire field body area, a set of parallel tracks has to be generated as the guidance lines for the agricultural machine. These field-work tracks can be represented either as straight-line segments or as curved polylines.
Rows: each row area is the area processed by an implement while driving along a track. The width of each row equals the effective implement width of the machine, .
The overlapped area is a double covered (processed) area, which occurs at headland turnings or at the first and last row when they are doubled by the headland area.
In the following, the specific methods of the generation of these entities are described.

Generation of Headland Passes and Headland Areas
A headland area must be generated for the field as well as for each of its obstacles. Each headland area consists of 2 rings, where is the number of headland passes, namely the field (or obstacle) boundary, the headland passes, and the headland boundary to the main field area (shown in Figure 6 with black, blue, and red rings, respectively). Let ∈ { , , … , } denote the boundary of the field and the boundaries of the obstacles. Let = {ℎ , … , ℎ } denote the headland passes (blue rings in Figure 6). The first headland pass is obtained by offsetting at distance /2 : ℎ = ∥ / . The subsequent headland passes are generated recursively by offsetting at distance from the previous headland pass: ℎ = ∥ , = 2, … , . Finally, the headland boundary ring (red rings in Figure 6) is created at a distance /2 from the last headland pass ℎ : = ∥ / . In this way, the headland area of a field or obstacle contains the rings: { , ℎ , ℎ , … , ℎ , }. For the field we denote the outer and inner boundaries and , respectively. The field body area can be obtained by using the subtraction operation = Δ( , ∑ ), which is the enclosed area by excluding the total area enclosed by the obstacle inner boundary , ∈ {1, … , } .

Tracks and Rows Generation
In the following, the method for generating straight and curved tracks is described.

Straight field-work tracks
As a first step, in order to restrict all generated tracks inside the operational area, a bounding envelope (the green rectangle in the Figure 7.a) of the field's headland boundary ring, , is generated with one edge of the envelope parallel to the driving direction . The edge is selected as a reference line for generating tracks. The number of field-work tracks for a complete coverage of area . is given by = ⌈| |/ ⌉ where ⌈ ⌉ is the ceil function and | | is the length of the edge of that is perpendicular to .   The specific steps for the generation of the field-work tracks and the corresponding rows, includes: 1. Firstly, each initial track is used to create a buffer polygon using the buffer operator / (Figure 8.a). Then, the intersection operator is used to find the intersection area between the buffer polygon and the inner field boundary disregarding obstacles: = ∩ ( , ) (Figure 8.b).
2. Next, the boolean intersect operator & is applied to check whether the intersects with the obstacles. Following this, there are three potential cases, as illustrated in Figure 8.c: Case 1: if is not intersected with any obstacle, then remains unchanged; Case 2: if only partially intersects with obstacles, then the subtraction operator is employed to obtain the subtracted area; and Case 3: if crosses through an obstacle, then the subtraction operator divides the polygon into sub-polygons. Other cases such as a partially intersects one obstacle and crosses through another obstacle are considered as the case of the combination of basic cases 2 and 3. 3. After the subtraction operation has been performed, each area is enclosed by a ring with multiple points denoted as a set { } (red points in Figure 8.c). To obtain the final track, , first, points in the set { } are projected to the initial track by the projection operator ⊥ to acquire the projection points set { }. Afterwards, the final track (black dotted lines in Figure 9.a) is created using the union operator ⨃({ }). In addition, the row of the final track (green area in Figure 9.b) is generated by employing the buffer operator / .
A field representation derived from applying these three steps on each row is illustrated in Figure 9c. The pseudo-code of the process is shown in algorithm 1.

Curved field-work tracks
The procedure to generate a geometrical map with curved tracks is similar to the procedure for straight tracks explained above. The differences stem from the fact that the reference line in latter case is a polyline. In the following, the procedure for generation of curved tracks is presented with reference to Figure 10.
To ensure that the operational area is fully covered with parallel, curved tracks, the minimumbounding envelope of the outer field border, , is used (Figure 10.a). The reference line is laid out along the inner field border, , such that the orientation of the line follows the clockwise ordering around the field inner boundary (Figure 10.b). Then, is extended to intersect with , resulting in the extended reference line, (Figure 10.c). Next, the first of a sequence of initial tracks = { , , … , } covering is generated. The first track is made up as an offset of of a width of 2 ⁄ : = ∥ ⁄ ′ (Figure 10.d). Note, that since , like as , follows the clockwise direction it is only required to use offset to the right ( for distance parameter) to make offset inwardly to operational area. The next steps are analogous to the generation of straight tracks: Generation of buffer polygon for each track (Figure 10.e); subtraction of area outside the inner field boarder and obstacle borders to obtain first and then (Figure 10.f); projection of points on to (Figure 10.g) to determine the final first track, and the corresponding row (Figure 10.h). Having completed the first track, the subsequent initial tracks can be generated recursively from the previous final track: = ∥ , = 2, … , . Then the initial track can be finalized into until the final tracks cover the entire operational area of the field (Figure 10.i). The pseudo-code for generation of curve tracks with corresponding rows is give in algorithm 2.

End
It has to be note that the reference line is not necessarily to be edge(s) of field boundary, it can be an edge in any angle for straight tracks generations, or any number of connected edges for curved tracks generations-in that situation, then the reference line need to offset to left and right sides by using the offset operator ∥ , until the tracks cover the entire operational area of the field based on the above-described procedures.

Overlapped Area Quantification
Overlapped area parts, , produced by each row R can be computed by using the subtraction operator (R, ), as illustrated in Figure 11. The total overlapped area (Ο) can be quantified as summation of each individual overlapped area of each row by = ∑ | | . Figure 11. An illustration of generated overlapped area (red area) for each row.

Implementation and Results
The algorithms for generation of geometrical field representations described above were implemented using the JAVA programming language (Oracle Corporation) and executed on a standard computer with a CPU of 3.2 GHz processor and a 4 GB RAM. To demonstrate the functionality of the process, 12 fields with different number of obstacles ranging, from one to six, were selected, representing a range of complexity levels of field shapes. The field shape files were provided by the GIS database from The Ministry of Environment and Food of Denmark. Three types of working width ( = 2m, 4 m, 6 m) were used. The driving direction for each field is represented by the red marked line suggested by technical staff, as shown in the Table 3. The results of average computation time of the method (as an average of 1,000 runs per case) are listed in Table 3.  Figure 12. The selected fields 2 (a) and 10 (b) (presented also in Table 3) and the selected direction reference lines (red marked lines) used in the scenario tests.
In addition, two scenario studies were carried out to investigate the effect of using different fieldwork tracks references, directions, and operating widths on the generated metric map. Figure 12 presents the two selected fields (field 2 and field 10 from Table 3) as examples that include both straight and curved field-work tracks.
In this scenario, field 10 was selected for test, and four straight reference lines for the generation of straight tracks were used as shown in Figure 13. Field geometrical representations for each direction with 6 m working width are illustrated in Table 4. The tested results are given in Table 4, in which we can see that the driving direction not only determines the number of generated tracks but also determines the size of the overlapped area when the working width is the same. In terms of number of tracks, the maximum difference is up to 56 when comparing driving direction d2 with d4 using working width = 4 m, while in terms of overlapped area, it can be found that larger working widths lead to larger overlapped areas, which corresponds with conclusions derived by Luck et al. (2010). Additionally, it can be seen that less tracks do not produce less overlapped area, for instance comparing d4 with d1 when working width was 4 m [24]. Figure 13. Field geometrical representations for direction d1, d2, d3, d4 with 6 m working width. In this scenario, two curved reference lines and two straight reference lines were used for the generation of tracks for field 2 and field geometrical representations for each direction with 6 m working width are illustrated in Figure 14, and these four reference lines are the possible choices a machine operator will make for field operations. From the results presented in Table 5, it can be seen that curved tracks resulted in less overlapped area when using the same working width. Among all these setups, the setup that using driving direction d1 and working width = 6 m might be the most favorable as it yields the fewest number of tracks-implying that less turns are required to cover the entire field, which, consequently might mean less non-working time.

Discussion
From the previous two scenario studies, we can see that the presented tool has the potential capability to be used as a decision support system to find, for example, the driving direction that yields the least overlaps (i.e., spraying), or the least number of turns, or can even be used as an input for high-level planning such as path planning [6,7], route planning [8][9][10][11][12][13], and field coverage planning [14][15][16][17][18].
Based on the test results in Table 3, the computational times of the presented method were in the range 0.26-24.51 s for various field shapes, and the area ranged between 10.27 and 74.58 ha. Compared with fields with straight tracks, the map generation for fields with curved tracks requires higher computational times. The average computational time for fields with straight tracks was 1.16 s, while for curved tracks it was 7.69 s. The main reason for higher computational times in the case of curved tracks is that each time a subsequent curved track is constructed, a new curved reference line has to be created, that is, the predecessor curved track. This repetitive process consumes a large percentage of the overall computational time.
The low computational times of the proposed method-in the level of seconds-provides the potential for real-time implementation in agricultural machine navigation systems, precision application tools (e.g., automatic boom section control for spraying), autonomous robots. The importance of a real-time map generation is derived from a number of reasons: • Not all information about field shapes is often available, so the operator has to drive around the field and obstacles boundaries to acquire the path coordinates, and so the map generation process has to take place on-site.

•
The field metric map should be generated based on the effective working width instead of the specified working width which in many cases the operator must adjust to field conditions. • Factors also such as soil condition in terms of moisture content also affects field shapes and thus affecting the field representation scheme. That might be the case, when, for example, a water area inside the field resulting from rain constitutes an operational obstacle for the proposed method and would require a new field representation to be generated in real-time, on site, for the remainder of the field operation.
The presented tool brings a number of advancements to the process of generating a metric map for arable farming field operations. These advancements include the real-time generation feature, the potential to deal with multiple-obstacle areas, and the reduction in the overlapped area. However, for considering this approach as "complete", a number of limitations still hold. These limitations include: • Regarding infield obstacles, the proposed method does not handle cases such as two obstacles in close proximity. These types of obstacles, from the operational point of view, should be considered as one obstacle. Furthermore, cases of small obstacles (e.g., trees, electricity pylons, etc.) that cause a local deviation from the designed track are not taken into account. The categorization of the obstacles depending on the driving direction, working width, the shape of field, size and location of obstacle [18] is an important step in the map generation since it affects the accuracy and feasibility of the generated field representation scheme.

•
In the case of curved tracks, each track consists of sequentially connected line segments. There are cases where it is not feasible for an agricultural machine to perform a sharp turn between two line segments due to operational limitations on the maximum turning curvature. Therefore, there is the need for the implementation of curved polyline smoothing algorithms to generate an easier steerable path for agricultural machines [12].

•
As part of the tool, the machine operator has to set the value of the number of headland passes manually for generation of the required headland space. It might be difficult for the user to determine an appropriate value due to the fact that the headland space depends on a number of factors such as field shapes, field condition, machine's kinematic features and so on. Therefore, an algorithm or model should be developed for this tool to improve the reliability of the field representation.

•
This tool needs further elaboration so that the user can interactively divide the field into subfields, where each subfield can have its own driving direction.

Conclusion
In this paper, a new approach for a metric map generation for autonomous field operations was developed. The generated map consists of either straight or curved field-work tracks for any complexity level of fields in terms of the shape and number of in-field obstacles. According to the test results on 12 selected fields with different numbers of obstacles and diverse shapes, the computational times were in the range of 0.26-24.51 s demonstrating that it is feasible for real-time implementation.
The proposed approach can be deployed for navigation-aiding system for agricultural machinery or as part of the high-level control of autonomous field machines. However, this tool still needs further elaboration in terms of extending with the capability of supporting field subdivision, automatic process for obstacles categorization, automatic determination of headland space, and smooth curve tracks generation.