Skip to content

Commit

Permalink
Headland -> up/down transition fix
Browse files Browse the repository at this point in the history
Do not skip a turn on connecting track if the turn starts
at the end of the connecting track leading into the
first up/down row.
  • Loading branch information
pvaiko committed Mar 26, 2022
1 parent e177d98 commit 89c4c96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/Course.lua
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,8 @@ end

--- How far are we from the waypoint marked as the beginning of the up/down rows?
---@param ix number start searching from this index. Will stop searching after 100 m
---@return number of meters or math.huge if no start up/down row waypoint found within 100 meters and the index of the first up/down waypoint
---@return number, number of meters or math.huge if no start up/down row waypoint found within 100 meters and the
--- index of the first up/down waypoint
function Course:getDistanceToFirstUpDownRowWaypoint(ix)
local d = 0
local isConnectingTrack = false
Expand Down
5 changes: 5 additions & 0 deletions scripts/ai/AIDriveStrategyFieldWorkCourse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ function AIDriveStrategyFieldWorkCourse:onWaypointChange(ix, course)
self:debug('connecting track ended, back to work, first lowering implements.')
self.state = self.states.WORKING
self:lowerImplements()
elseif self.course:isTurnStartAtIx(ix) and
not self.course:isOnConnectingTrack(ix + 1) and
not self.course:isOnHeadland(ix + 1)then
self:debug('ending connecting track with a turn into the up/down rows')
self:startTurn(ix)
end
elseif self.state == self.states.WORKING then
-- towards the end of the field course make sure the implement reaches the last waypoint
Expand Down

0 comments on commit 89c4c96

Please sign in to comment.