Skip to content

Commit

Permalink
Merge pull request #1290 from Courseplay/connecting-track-end
Browse files Browse the repository at this point in the history
Headland -> up/down transition fix
  • Loading branch information
Tensuko committed Mar 27, 2022
2 parents f88162f + 89c4c96 commit 39c58fa
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 39c58fa

Please sign in to comment.