You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/Course.lua
+28-5Lines changed: 28 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -635,6 +635,29 @@ function Course:isNextTurnLeft(ix)
635
635
end
636
636
end
637
637
638
+
--- Should the plow be rotated to the left at the waypoint ix?
639
+
--- On the headland just check which side was worked last, on the center, check the direction of the next turn
640
+
--- as at the first pass both sides are unworked and need some other indication on which side the plow should be
641
+
functionCourse:shouldPlowBeOnTheLeft(ix)
642
+
localplowShouldBeOnTheLeft
643
+
ifself:isOnHeadland(ix) then
644
+
localclockwise=self:isOnClockwiseHeadland(ix)
645
+
plowShouldBeOnTheLeft=notclockwise
646
+
CpUtil.debugVehicle(CpDebug.DBG_TURN, self.vehicle, 'On a headland (clockwise %s), plow should be on the left %s', tostring(clockwise), tostring(plowShouldBeOnTheLeft))
647
+
else
648
+
localisNextTurnLeft=self:isNextTurnLeft(ix)
649
+
ifisNextTurnLeft==nilthen
650
+
-- don't know if left or right, so just use the last worked side
651
+
plowShouldBeOnTheLeft=self:isLeftSideWorked(ix)
652
+
CpUtil.debugVehicle(CpDebug.DBG_TURN, self.vehicle, 'On the center, next turn direction unknown, plow should be on the left %s', tostring(plowShouldBeOnTheLeft))
653
+
else
654
+
plowShouldBeOnTheLeft=notisNextTurnLeft
655
+
CpUtil.debugVehicle(CpDebug.DBG_TURN, self.vehicle, 'On the center, plow should be on the left %s', tostring(plowShouldBeOnTheLeft))
656
+
end
657
+
end
658
+
returnplowShouldBeOnTheLeft
659
+
end
660
+
638
661
functionCourse:getIxRollover(ix)
639
662
ifix>#self.waypointsthen
640
663
returnix-#self.waypoints
@@ -1455,7 +1478,7 @@ end
1455
1478
localfunctioncalculateYRot(waypoints, i)
1456
1479
localx1, z1=waypoints[i].x, waypoints[i].z
1457
1480
localx2, z2=waypoints[i+1].x, waypoints[i+1].z
1458
-
if (x1-x2) ==0and (z1-z2) ==0then
1481
+
if (x1-x2) ==0and (z1-z2) ==0then
1459
1482
-- Divide by zero fix ..
1460
1483
return0
1461
1484
end
@@ -1810,13 +1833,13 @@ function Course.MultiVehicleData.createFromStream(stream, nVehicles)
0 commit comments