@anandommi/fields2cover 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +73 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -57,6 +57,79 @@ returns raw coordinates and stats, and throws on bad input.
57
57
 
58
58
  For large fields, run it inside a `worker_threads` worker so it does not block the event loop.
59
59
 
60
+ ## Inputs
61
+
62
+ | input | required | unit | meaning |
63
+ |---|---|---|---|
64
+ | `polygonCoords` | yes | `[lng, lat]` ring | field boundary, closed (first point = last point), at least 4 positions |
65
+ | `referenceLineCoords` | yes | `[lng, lat]` × 2+ | rows are laid out parallel to this line; its two end points must differ |
66
+ | `offsetDistance` | yes | m, > 0 | headland width: the band along the boundary (and around obstacles) where every turn happens; it is also mowed with headland laps |
67
+ | `spacing` | yes | m, > 0 | distance between neighbouring rows (normally the mower's cutting width) |
68
+ | `turningRadius` | yes | m, > 0 | the vehicle's minimum turning radius |
69
+ | `obstacleAvoid` | no | boolean | plan rows and turns around `obstaclePolygons` |
70
+ | `obstaclePolygons` | no | `[lng, lat]` rings | trees, sheds, ponds; self-intersecting outlines are repaired |
71
+ | `crissCross` | no | boolean | add a second pass at 90° (grid pattern) |
72
+ | `joinStartAndEnd` | no | boolean | close the path back to its start point |
73
+
74
+ ## Choosing values for full coverage
75
+
76
+ **Rule: `offsetDistance` ≥ `turningRadius` + 1.5 m.**
77
+
78
+ Every turn has to fit inside the headland. A turn needs about one turning radius
79
+ of space past the end of the row. The planner also keeps a 0.3 m gap from the
80
+ boundary and a 1.0 m gap from obstacles. If the headland is too narrow, those
81
+ turns do not fit and **the rows are left out of the path without any error or
82
+ warning**. The call still returns `status: 200`, but parts of the field are not
83
+ mowed. Slanted boundary edges need extra room, because the turn swings toward
84
+ the edge. The 1.5 m margin covers both.
85
+
86
+ | `turningRadius` | minimum `offsetDistance` |
87
+ |---|---|
88
+ | 1 m | 2.5 m |
89
+ | 1.5 m | 3 m |
90
+ | 2 m | 3.5 m |
91
+ | 3 m | 4.5 m |
92
+ | 4 m | 5.5 m |
93
+
94
+ Measured coverage with these values on a 2.3 ha test field (six sides, two
95
+ slanted edges, a round obstacle and a rectangular obstacle). Coverage is the
96
+ share of the field outside obstacles that the cutting width passes over:
97
+
98
+ | spacing | R = 1 m | R = 2 m | R = 3 m | R = 4 m |
99
+ |---|---|---|---|---|
100
+ | 0.5 m | 100 % | 99.75 % | 99.93 % | 99.87 % |
101
+ | 1 m | 99.78 % | 99.99 % | 99.93 % | 99.89 % |
102
+ | 1 m, grid pattern | 100 % | 100 % | 99.96 % | 99.95 % |
103
+ | 2 m | 99.57 % | 99.98 % | 99.97 % | 99.90 % |
104
+ | 3 m | 99.97 % | 100 % | 99.98 % | 99.91 % |
105
+
106
+ Spacing 1 m, `offsetDistance` 4 m and `turningRadius` 1.5 m gave 99.98–100 % in
107
+ every case tested: plain field, edited boundary, grid pattern and
108
+ `joinStartAndEnd`.
109
+
110
+ What happens when the headland is too narrow (spacing 1 m, same field, with obstacles):
111
+
112
+ | `offsetDistance` | `turningRadius` | coverage | rows left out | planning time |
113
+ |---|---|---|---|---|
114
+ | 2 m | 2 m | 31 % | 123 | 11 s |
115
+ | 3 m | 3 m | 35 % | 122 | 18 s |
116
+ | 3.5 m | 3 m | 81 % | 47 | 38 s |
117
+ | 3.5 m | 2 m | 99.99 % | 0 | 4 s |
118
+
119
+ Notes:
120
+
121
+ - The original Fields2Cover does not enforce a headland-vs-turning-radius rule
122
+ either. Its tutorials use 3 × the robot width. A common rule of thumb is
123
+ headland ≥ 2 × turning radius. This package pairs rows that are far apart
124
+ instead of turning into the next row, so it needs less: about one radius plus
125
+ the clearance.
126
+ - Even with these values, an obstacle that leaves a small pocket can sometimes
127
+ leave 1 row out (the 99.6–99.8 % cells above). If that row matters, add 0.5 m
128
+ to `offsetDistance`.
129
+ - Planning slows down sharply when the headland is too narrow, as in the table
130
+ above. A long planning time is a sign to increase `offsetDistance`.
131
+ - Tracked in [#2](https://github.com/AnandOmmi/fields2cover/issues/2).
132
+
60
133
  ## Releasing
61
134
 
62
135
  1. Bump `version` in `package.json` and add a `CHANGELOG.md` entry.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anandommi/fields2cover",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Pure-JavaScript Fields2Cover-style coverage path planner for mowers: headlands, boustrophedon cells, swaths, Dubins turns and headland laps on GeoJSON fields.",
5
5
  "main": "index.js",
6
6
  "files": [