Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: config to adjust tight turn offset #3179

Merged
merged 4 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions config/VehicleConfigurations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -141,6 +141,14 @@ 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.

- tightTurnOffsetDistanceInTurns: float
"Tight turn offset" is extending the radius of turns with a towed implement, in
order to keep the implement on the path, while the tractor is driving outside the
generated turn course. This is usually applied to the last curvy 10-20 meters of the
turn course. With this value you can override the default to make this section
shorter for some implements, especially big plows turn on the spot and align
better with the next row without tight turn offset.

-->
<VehicleConfigurations>
<Configurations>
Expand Down Expand Up @@ -169,6 +177,7 @@ You can define the following custom settings:
<Configuration type="INT">basePipeMovingToolIndex</Configuration>
<Configuration type="INT">childPipeMovingToolIndex</Configuration>
<Configuration type="FLOAT">unloadOffsetX</Configuration>
<Configuration type="FLOAT">tightTurnOffsetDistanceInTurns</Configuration>
</Configurations>
<!--[GIANTS]-->

Expand Down Expand Up @@ -468,7 +477,9 @@ You can define the following custom settings:
<Vehicle name="pw10012.xml"
noReverse = "true"
implementWheelAlwaysOnGround = "true"
turnRadius = "7.5"
tightTurnOffsetDistanceInTurns = "1"
workingWidth = "5.8"
turnRadius = "7.8"
raiseLate = "true"
lowerEarly = "true"
/>
Expand Down
7 changes: 4 additions & 3 deletions scripts/ai/AIUtil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scripts/ai/turns/AITurn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,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
Expand Down Expand Up @@ -987,7 +987,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)
Expand Down
7 changes: 5 additions & 2 deletions scripts/ai/turns/TurnManeuver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ function AnalyticTurnManeuver:init(vehicle, turnContext, vehicleDirectionNode, t
self.course = self:findAnalyticPath(vehicleDirectionNode, 0, turnEndNode, 0, goalOffset, self.turningRadius)

-- make sure we use tight turn offset towards the end of the course so a towed implement is aligned with the new row
self.course:setUseTightTurnOffsetForLastWaypoints(10)

self.course:setUseTightTurnOffsetForLastWaypoints(
g_vehicleConfigurations:getRecursively(vehicle, 'tightTurnOffsetDistanceInTurns') or 10)
local ixBeforeEndingTurnSection = self.course:getNumberOfWaypoints()
-- and once again, if there is an ending course, keep adjusting the tight turn offset
local endingTurnLength = self.turnContext:appendEndingTurnCourse(self.course, steeringLength, true)
Expand Down Expand Up @@ -428,7 +430,8 @@ function TurnEndingManeuver:init(vehicle, turnContext, vehicleDirectionNode, tur
self:generateStraightSection(endArc, endStraight)
myCorner:delete()
self.course = Course(vehicle, self.waypoints, true)
self.course:setUseTightTurnOffsetForLastWaypoints(20)
self.course:setUseTightTurnOffsetForLastWaypoints(
g_vehicleConfigurations:getRecursively(vehicle, 'tightTurnOffsetDistanceInTurns') or 20)
TurnManeuver.setLowerImplements(self.course, math.max(math.abs(turnContext.frontMarkerDistance), steeringLength))
end

Expand Down
Loading