From e4243b7240cde74a04d71d41272a5a4b6be7cc9a Mon Sep 17 00:00:00 2001 From: Peter Vaiko Date: Thu, 28 Mar 2024 06:37:37 -0400 Subject: [PATCH] feat: config to disable tight turn offset Added vehicle config option to disable tight turn offset in 180 turns. #3173 --- config/VehicleConfigurations.xml | 10 +++++++++- scripts/ai/AIUtil.lua | 7 ++++--- scripts/ai/turns/AITurn.lua | 8 +++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/config/VehicleConfigurations.xml b/config/VehicleConfigurations.xml index e1d5673bc..d953b1eeb 100644 --- a/config/VehicleConfigurations.xml +++ b/config/VehicleConfigurations.xml @@ -128,7 +128,7 @@ You can define the following custom settings: Disables the pipe height adjustment for trailers of a few pipe implements/vehicles. - ignorePipeMovingToolIndex: int - Ignores the given pipe moving tool by it's index. + Ignores the given pipe moving tool by its index. This can be used to ignore a pipe moving part and only use one part. An example is the premium expansion Dewulf P3K Profi. @@ -141,6 +141,13 @@ You can define the following custom settings: Moving tool index for the pipe controller to control the pipe height. This index is for the pipe part that is directly connected to the discharge node. +- disableTightTurnOffsetInTurns: boolean + "Tight turn offset" is extending the radius of a turn with a towed implement, in + order to keep the implement on the path, while the tractor is driving outside the + generated turn course. Setting this to true disables this, as some implements, + especially big plows turn on the spot and align better with the next row without + tight turn offset. + --> @@ -169,6 +176,7 @@ You can define the following custom settings: basePipeMovingToolIndex childPipeMovingToolIndex unloadOffsetX + disableTightTurnOffsetInTurns diff --git a/scripts/ai/AIUtil.lua b/scripts/ai/AIUtil.lua index 034f3019a..204250082 100644 --- a/scripts/ai/AIUtil.lua +++ b/scripts/ai/AIUtil.lua @@ -321,9 +321,10 @@ end ---@param vehicle table ---@param object table ---@return boolean -function AIUtil.isObjectAttachedOnTheBack(vehicle,object) - local _, _, dz = localToLocal(object.rootNode, AIUtil.getDirectionNode(vehicle), 0, 0, 0) - if dz < 0 then +function AIUtil.isObjectAttachedOnTheBack(vehicle, object) + -- TODO: now in the implement's coordinate system, this is still not 100% reliable in turns + local _, _, dz = localToLocal(AIUtil.getDirectionNode(vehicle), object.rootNode, 0, 0, 0) + if dz > 0 then return true end return false diff --git a/scripts/ai/turns/AITurn.lua b/scripts/ai/turns/AITurn.lua index ffeafcd60..378405b86 100644 --- a/scripts/ai/turns/AITurn.lua +++ b/scripts/ai/turns/AITurn.lua @@ -619,7 +619,9 @@ end function CourseTurn:onWaypointChange(ix) AITurn.onWaypointChange(self, ix) - if self.turnCourse then + local tightTurnOffsetDisabled = not self.turnContext:isHeadlandCorner() and + g_vehicleConfigurations:getRecursively(self.vehicle, 'disableTightTurnOffsetInTurns') + if self.turnCourse and not tightTurnOffsetDisabled then if self.forceTightTurnOffset or (self.enableTightTurnOffset and self.turnCourse:useTightTurnOffset(ix)) then -- adjust the course a bit to the outside in a curve to keep a towed implement on the course -- TODO_22 @@ -732,7 +734,7 @@ function CourseTurn:onPathfindingDone(path) self.turnCourse:setUseTightTurnOffsetForLastWaypoints(15) local endingTurnLength = self.turnContext:appendEndingTurnCourse(self.turnCourse, nil, true) local x = AIUtil.getDirectionNodeToReverserNodeOffset(self.vehicle) - self:debug('Extending course at direction switch for reversing to %.1f m (or at least 1m)', -x ) + self:debug('Extending course at direction switch for reversing to %.1f m (or at least 1m)', -x) self.turnCourse:adjustForReversing(math.max(1, -x)) TurnManeuver.setLowerImplements(self.turnCourse, endingTurnLength, true) else @@ -987,7 +989,7 @@ function StartRowOnly:init(vehicle, driveStrategy, ppc, turnContext, startRowCou local _, steeringLength = AIUtil.getSteeringParameters(self.vehicle) self.enableTightTurnOffset = steeringLength > 0 and not AIUtil.hasArticulatedAxis(self.vehicle) - -- TODO: do we need tight turn offset here? + -- TODO: do we need tight turn offset here? self.turnCourse:setUseTightTurnOffsetForLastWaypoints(15) -- add a turn ending section into the row to make sure the implements are lowered correctly local endingTurnLength = self.turnContext:appendEndingTurnCourse(self.turnCourse, 3, true)