Skip to content

Commit 36e027f

Browse files
author
Peter Vaiko
committed
fix: Reeds-Shepp headland turn
Use a Reeds-Shepp turn instead of the old combine headland turn which used angles and relative distances to steer the vehicle. #786
1 parent 3241e25 commit 36e027f

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

scripts/Course.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,13 +915,13 @@ function Course:extend(length, dx, dz)
915915
for i = first, last, step do
916916
local x = lastWp.x + dx * i
917917
local z = lastWp.z + dz * i
918-
self:appendWaypoint({ x = x, z = z })
918+
self:appendWaypoint({ x = x, z = z, rev = lastWp.rev })
919919
end
920920
if length % step > 0 then
921921
-- add the remainder to make sure we extend all the way up to length
922922
local x = lastWp.x + dx * length
923923
local z = lastWp.z + dz * length
924-
self:appendWaypoint({ x = x, z = z })
924+
self:appendWaypoint({ x = x, z = z, rev = lastWp.rev })
925925
end
926926
-- enrich the waypoints we added
927927
self:enrichWaypointData(nWaypoints)

scripts/CpUtil.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ function CpUtil.getAllRootVegetables()
466466
local preparedGrowthState = fruitTypeData.preparedGrowthState
467467
local name = fruitTypeData.name
468468

469-
-- check if fruit is needs herb removement to be harvested
469+
-- check if fruit is needs herb removal to be harvested
470470
if minPreparingGrowthState ~= -1 and preparedGrowthState ~= -1 and name ~= "SUGARCANE" then
471471
local fruitType = g_fruitTypeManager:getFruitTypeByName(name)
472472
if fruitType ~= nil then

scripts/ai/turns/AITurn.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ end
763763
function CombineHeadlandTurn:startTurn()
764764
self:debug('Starting a combine headland turn')
765765
self.turnCourse = ReedsSheppHeadlandTurn(self.vehicle, self.turnContext,
766-
self.turnContext.vehicleAtTurnStartNode, self.turningRadius):getCourse()
766+
self.vehicle:getAIDirectionNode(), self.turningRadius):getCourse()
767767
self.state = self.states.TURNING
768768
self.ppc:setCourse(self.turnCourse)
769769
self.ppc:initialize(1)

scripts/ai/turns/TurnManeuver.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ function ReedsSheppHeadlandTurn:init(vehicle, turnContext, vehicleDirectionNode,
565565
turnContext.lateWorkStartNode, 0, -turnContext.backMarkerDistance, turningRadius)
566566
self.course = Course.createFromAnalyticPath(vehicle, path, true)
567567
self.course:adjustForReversing(2)
568+
-- add a little straight section to the end so we have a little buffer and don't end the turn right at
569+
-- the work start
570+
self.course:extend(5)
571+
TurnManeuver.setLowerImplements(self.course, 5, true)
568572
end
569573

570574
---@class TurnEndingManeuver : TurnManeuver

0 commit comments

Comments
 (0)