Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
6.01.00182 Fix sprayers leaving unworked patches at end of row
Browse files Browse the repository at this point in the history
#3594 and #3242

Sprayers have a rectangular work area but the spray is at an angle so
the front of the area is not covered.

Also, some sprayers have multiple work areas depending on the configuration
and fill type which can also move the front or back markers.

This leads to little unsprayed rectangles at the row ends as the turn
code turns off the sprayer when the back marker (which is actually in the
front when the implement is attached to the back of the vehicle) reaches the
field edge.

So, if both the front and back markers are from sprayer work areas, move
the back marker to where the front marker is which will result turning
off the sprayer later.
  • Loading branch information
pvaiko committed Apr 12, 2019
1 parent 4242e32 commit 94de542
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="40">
<version>6.01.00181</version>
<version>6.01.00182</version>
<author><![CDATA[Courseplay.devTeam]]></author>
<title>
<br>CoursePlay SIX</br>
Expand Down
24 changes: 12 additions & 12 deletions specialTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -870,9 +870,9 @@ function courseplay:askForSpecialSettings(self, object)
--- SPECIAL VARIABLES THAT CAN BE USED:
--
-- automaticToolOffsetX: (Distance in meters) Used to automatically set the tool horizontal offset. Negagive value = left, Positive value = right.
-- object.cp.backMarkerOffsetCorection: (Distance in meters) If the implement stops to early or to late, you can specify then it needs to raise and/or turn off the work tool
-- object.cp.backMarkerOffsetCorrection: (Distance in meters) If the implement stops to early or to late, you can specify then it needs to raise and/or turn off the work tool
-- Positive value, moves it forward, Negative value moves it backwards.
-- object.cp.frontMarkerOffsetCorection: (Distance in meters) If the implement starts to early or to late, you can specify then it needs to lower and/or turn on the work tool
-- object.cp.frontMarkerOffsetCorrection: (Distance in meters) If the implement starts to early or to late, you can specify then it needs to lower and/or turn on the work tool
-- Positive value, moves it forward, Negative value moves it backwards.
-- object.cp.haveInversedRidgeMarkerState: (Boolean) If the ridmarker is using the wrong side in auto mode, set this value to true
-- object.cp.realUnfoldDirectionIsReversed: (Boolean) If the tool unfolds when driving roads and folds when working fields, then set this one to true to reverse the folding order.
Expand Down Expand Up @@ -908,8 +908,8 @@ function courseplay:askForSpecialSettings(self, object)

-- OBJECTS
if object.cp.isSP400F then
object.cp.backMarkerOffsetCorection = 0.5;
object.cp.frontMarkerOffsetCorection = -0.25;
object.cp.backMarkerOffsetCorrection = 0.5;
object.cp.frontMarkerOffsetCorrection = -0.25;

elseif object.cp.isUrsusT127 then
object.cp.specialUnloadDistance = -1.8;
Expand All @@ -930,8 +930,8 @@ function courseplay:askForSpecialSettings(self, object)

elseif object.cp.isSalford8312 then
automaticToolOffsetX = 0.4; -- ToolOffsetX is 0.4 meters to the right
object.cp.backMarkerOffsetCorection = -7.5;
object.cp.frontMarkerOffsetCorection = -10;
object.cp.backMarkerOffsetCorrection = -7.5;
object.cp.frontMarkerOffsetCorrection = -10;

elseif object.cp.isLemkenTitan18 then
automaticToolOffsetX = 0.8; -- ToolOffsetX is 0.8 meters to the right
Expand Down Expand Up @@ -982,15 +982,15 @@ function courseplay:askForSpecialSettings(self, object)
end

elseif object.cp.isHolmerHR9 then
object.cp.frontMarkerOffsetCorection = 2;
object.cp.frontMarkerOffsetCorrection = 2;

elseif object.cp.isKuhnDiscolanderXM52 then
object.cp.frontMarkerOffsetCorection = 5.6;
object.cp.backMarkerOffsetCorection = -4.5;
object.cp.frontMarkerOffsetCorrection = 5.6;
object.cp.backMarkerOffsetCorrection = -4.5;

elseif object.cp.isHatzenbichlerTerminator18 then
object.cp.frontMarkerOffsetCorection = -6.5;
object.cp.backMarkerOffsetCorection = -6.5;
object.cp.frontMarkerOffsetCorrection = -6.5;
object.cp.backMarkerOffsetCorrection = -6.5;

elseif object.cp.isHatzenbichlerTH1400 then
object.cp.noWorkArea = true;
Expand All @@ -999,7 +999,7 @@ function courseplay:askForSpecialSettings(self, object)
automaticToolOffsetX = 2.1;

elseif object.cp.isBednarSM18000 then
object.cp.backMarkerOffsetCorection = -3.25;
object.cp.backMarkerOffsetCorrection = -3.25;

elseif object.cp.isSWT7 then
automaticToolOffsetX = -2.2;
Expand Down
22 changes: 20 additions & 2 deletions toolManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,12 @@ function courseplay:setMarkers(vehicle, object)
-- Calculate the offset based on the distances
local ztt = vehicleDistances.turningNodeToRearTrailerAttacherJoints[activeInputAttacherJoint.jointType] * -1;

local backMarkerCorrection = Utils.getNoNil(object.cp.backMarkerOffsetCorection, 0);
local backMarkerCorrection = Utils.getNoNil(object.cp.backMarkerOffsetCorrection, 0);
if vehicle.cp.backMarkerOffset == nil or (abs(backMarkerCorrection) > 0 and ztt + backMarkerCorrection > vehicle.cp.backMarkerOffset) then
vehicle.cp.backMarkerOffset = abs(backMarkerCorrection) > 0 and ztt + backMarkerCorrection or 0;
end

local frontMarkerCorrection = Utils.getNoNil(object.cp.frontMarkerOffsetCorection, 0);
local frontMarkerCorrection = Utils.getNoNil(object.cp.frontMarkerOffsetCorrection, 0);
if vehicle.cp.aiFrontMarker == nil or (abs(frontMarkerCorrection) > 0 and ztt + frontMarkerCorrection < vehicle.cp.aiFrontMarker) then
vehicle.cp.aiFrontMarker = abs(frontMarkerCorrection) > 0 and ztt + frontMarkerCorrection or -3;
end
Expand All @@ -587,6 +587,7 @@ function courseplay:setMarkers(vehicle, object)
return;
end

local backMarkerAreaType, frontMarkerAreaType
-- TODO: figure out what other types to avoid, the FS17 types ending with DROP do not seem to exist anymore
local avoidType = {
[WorkAreaType.RIDGEMARKER] = true
Expand Down Expand Up @@ -630,9 +631,11 @@ function courseplay:setMarkers(vehicle, object)
object:getName(), type, g_workAreaTypeManager.workAreaTypes[area.type].name, tostring(j), ztt)
if object.cp.backMarkerOffset == nil or ztt + Utils.getNoNil(object.cp.backMarkerOffsetCorection, 0) > object.cp.backMarkerOffset then
object.cp.backMarkerOffset = ztt + Utils.getNoNil(object.cp.backMarkerOffsetCorection, 0);
backMarkerAreaType = area.type
end
if object.cp.aiFrontMarker == nil or ztt + Utils.getNoNil(object.cp.frontMarkerOffsetCorection, 0) < object.cp.aiFrontMarker then
object.cp.aiFrontMarker = ztt + Utils.getNoNil(object.cp.frontMarkerOffsetCorection, 0);
frontMarkerAreaType = area.type
end
end
end
Expand All @@ -649,6 +652,21 @@ function courseplay:setMarkers(vehicle, object)
vehicle.cp.aiFrontMarker = object.cp.aiFrontMarker + aLittleBitMore * 0.75;
end

-- Sprayers have a rectangular work area but the spray is at an angle so the front of the area is not covered.
-- Also, some sprayers have multiple work areas depending on the configuration and fill type which can also
-- move the front or back markers.
-- This leads to little unsprayed rectangles at the row ends as the turn code turns off the sprayer when the back
-- marker (which is actually in the front when the implement is attached to the back of the vehicle) reaches the
-- field edge.
-- So, if both the front and back markers are from sprayer work areas, move the back marker to where the front
-- marker is which will result turning off the sprayer later.
if frontMarkerAreaType and backMarkerAreaType and
frontMarkerAreaType == WorkAreaType.SPRAYER and
backMarkerAreaType == WorkAreaType.SPRAYER then
courseplay.debugVehicle(6, vehicle, "Forcing backmarker to frontmarker for sprayer")
vehicle.cp.backMarkerOffset = vehicle.cp.aiFrontMarker
end

courseplay.debugVehicle(6, vehicle, '(%s), setMarkers(): cp.backMarkerOffset = %s, cp.aiFrontMarker = %s',
nameNum(object), tostring(vehicle.cp.backMarkerOffset), tostring(vehicle.cp.aiFrontMarker))
end;
Expand Down
10 changes: 0 additions & 10 deletions turn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -677,16 +677,6 @@ function courseplay:turn(vehicle, dt)
vehicle.cp.lowerToolThisTurnLoop = false;
end;

-- TODO: this may not be needed anymore as handled by AIDriver:holdInTurnManeuver()
if vehicle.spec_combine and vehicle.spec_combine.strawPSenabled then
vehicle.cp.savedNoStopOnTurn = vehicle.cp.noStopOnTurn
vehicle.cp.noStopOnTurn = false;
turnTimer = vehicle.spec_combine.processing.toggleTime / 1000 or 5;
elseif vehicle.cp.savedNoStopOnTurn ~= nil then
vehicle.cp.noStopOnTurn = vehicle.cp.savedNoStopOnTurn;
vehicle.cp.savedNoStopOnTurn = nil;
end;

--- Use the speed limit if we are still working and turn speed is higher that the speed limit.
refSpeed = courseplay:getSpeedWithLimiter(vehicle, refSpeed);

Expand Down

0 comments on commit 94de542

Please sign in to comment.