From 94de542c5a3d8c3b67255ce3a7ada5bf5200603d Mon Sep 17 00:00:00 2001 From: Peter Vaiko <github@vaiko.us> Date: Thu, 11 Apr 2019 21:00:53 -0500 Subject: [PATCH] 6.01.00182 Fix sprayers leaving unworked patches at end of row #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. --- modDesc.xml | 2 +- specialTools.lua | 24 ++++++++++++------------ toolManager.lua | 22 ++++++++++++++++++++-- turn.lua | 10 ---------- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/modDesc.xml b/modDesc.xml index 8a4923221..df8c7f336 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -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> diff --git a/specialTools.lua b/specialTools.lua index f341a8c56..adda6de9a 100644 --- a/specialTools.lua +++ b/specialTools.lua @@ -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. @@ -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; @@ -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 @@ -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; @@ -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; diff --git a/toolManager.lua b/toolManager.lua index 7721e98ab..795121dd3 100644 --- a/toolManager.lua +++ b/toolManager.lua @@ -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 @@ -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 @@ -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 @@ -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; diff --git a/turn.lua b/turn.lua index 5d96fc89e..09a8dcbeb 100644 --- a/turn.lua +++ b/turn.lua @@ -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);