Skip to content

Commit 98c630a

Browse files
author
Peter Vaiko
committed
fix: include the reverser node offset
#786
1 parent febf885 commit 98c630a

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/ai/turns/AITurn.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ end
762762

763763
function CombineHeadlandTurn:startTurn()
764764
self:debug('Starting a combine headland turn')
765-
self.turnCourse = ReedsSheppHeadlandTurn(self.vehicle, self.turnContext,
765+
self.turnCourse = ReedsSheppHeadlandTurnManeuver(self.vehicle, self.turnContext,
766766
self.vehicle:getAIDirectionNode(), self.turningRadius):getCourse()
767767
self.state = self.states.TURNING
768768
self.ppc:setCourse(self.turnCourse)

scripts/ai/turns/TurnManeuver.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,13 @@ function ReedsSheppTurnManeuver:findAnalyticPath(vehicleDirectionNode, startXOff
552552
return course
553553
end
554554

555-
---@class ReedsSheppHeadlandTurn : TurnManeuver
556-
ReedsSheppHeadlandTurn = CpObject(TurnManeuver)
555+
---@class ReedsSheppHeadlandTurnManeuver : TurnManeuver
556+
ReedsSheppHeadlandTurnManeuver = CpObject(TurnManeuver)
557557

558558
--- This is a headland turn (~90 degrees) for non-towed harvesters with cutter on the front. Expected to be called
559559
--- just after the cutter finished the corner, that is, the harvester should drive forward in the original direction
560560
--- until there is no fruit left. It'll then do a quick 90 degree 3 point turn to align with the new direction.
561-
function ReedsSheppHeadlandTurn:init(vehicle, turnContext, vehicleDirectionNode, turningRadius)
561+
function ReedsSheppHeadlandTurnManeuver:init(vehicle, turnContext, vehicleDirectionNode, turningRadius)
562562
local solver = ReedsSheppSolver()
563563
-- use lateWorkStartNode since we covered the corner in the inbound direction already
564564
local path = PathfinderUtil.findAnalyticPath(solver, vehicleDirectionNode, 0, 0,
@@ -567,7 +567,7 @@ function ReedsSheppHeadlandTurn:init(vehicle, turnContext, vehicleDirectionNode,
567567
self.course:adjustForReversing(2)
568568
-- add a little straight section to the end so we have a little buffer and don't end the turn right at
569569
-- the work start
570-
self.course:extend(5)
570+
self.course:extend(self:getReversingOffset() + 1)
571571
TurnManeuver.setLowerImplements(self.course, 5, true)
572572
end
573573

0 commit comments

Comments
 (0)