Skip to content

Commit

Permalink
feat: config distance for tight turn offset
Browse files Browse the repository at this point in the history
Added vehicle config option to override default distance
from turn end where tight turn offset is applied
in 180 turns.

#3173
  • Loading branch information
pvaiko committed Mar 28, 2024
1 parent b8bf32e commit d69781f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
13 changes: 7 additions & 6 deletions config/VehicleConfigurations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +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
- 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. 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.
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>
Expand Down Expand Up @@ -176,7 +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="BOOL">disableTightTurnOffsetInTurns</Configuration>
<Configuration type="FLOAT">tightTurnOffsetDistanceInTurns</Configuration>
</Configurations>
<!--[GIANTS]-->

Expand Down
4 changes: 1 addition & 3 deletions scripts/ai/turns/AITurn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,7 @@ end

function CourseTurn:onWaypointChange(ix)
AITurn.onWaypointChange(self, ix)
local tightTurnOffsetDisabled = not self.turnContext:isHeadlandCorner() and
g_vehicleConfigurations:getRecursively(self.vehicle, 'disableTightTurnOffsetInTurns')
if self.turnCourse and not tightTurnOffsetDisabled then
if self.turnCourse 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
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

0 comments on commit d69781f

Please sign in to comment.