Open Tubezki opened 2 years ago
Hello! got the same issue when testing, will look into it when i get a little bit of more time.
I am honored that you want to support me and if you want there is a sponsor button on the right.
Hello, I'm not sure if this is the right place (might also caused by another REA module) but I also noticed some kind of shaking with the Kverneland PW 100-12 Plow. It looked like the plow was dragged back and forth behind the tractor (John Deere 8RT).
I disabled the REA mods and the issue was gone. Nontheless this mod is a great addition and I appreciate your efford.
im note sure wich one off the pices of code fixed the shaking issue butt i did the following:
1) Function to create force positions (changed plow to cultivator) 2) Function to create force positions (changed plow to cultivator) 3) So now i have 4 Function to Create force positions 2 with plow and 2 with cultivator
function REAimplements:CreateForcePositions(Vehicle,ToolType,PowerConsumer,WorkAreas)
-- Create force position table
PowerConsumer.ForcePosition = {};
local ParentNode = PowerConsumer.forceNode;
-- Create Force nodes
if ToolType == REAimplements.Cultivator then
local numWorkArea = table.getn(WorkAreas);
if numWorkArea > 1 then
-- Not nice... Only to get plows with two workareas to work :(
local HasTwoPlowareas = WorkAreas[2].type == WorkAreaType.Cultivator;
if HasTwoWorkareas then
if Vehicle.spec_wheels ~= nil then
if Vehicle.spec_wheels.wheels ~= nil then
if table.getn(Vehicle.specwheels.wheels) > 1 then
local LargestRadius = 0;
local ActWheel;
for ,wheel in pairs(Vehicle.spec_wheels.wheels) do
if wheel.radiusOriginal > LargestRadius then
ActWheel = wheel;
LargestRadius = wheel.radiusOriginal;
end;
end;
-- Create parent for force positipn nodes
local ForceParent = createTransformGroup("ForceParent")
link(ActWheel.repr, ForceParent);
setTranslation(ForceParent,0,0,0);
setRotation(ForceParent,0,0,0);
setScale(ForceParent,1,1,1);
ParentNode = ForceParent;
REAimplements:PrintDebug("REA implements: " .. Vehicle:getFullName() .. " as a " .. REAimplements.ToolTypeNames[Vehicle.ToolType] .. " uses wheel as a reference")
end;
end;
end;
end;
end;
PowerConsumer.ForcePosition[REAimplements.LeftFront] = {};
PowerConsumer.ForcePosition[REAimplements.LeftFront].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionLeftFrontNode");
PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode = REAimplements:CreateNode(ParentNode,0,0,0,"GroundPositionLeftFrontNode");
REAimplements:SetIsLeft(PowerConsumer,REAimplements.LeftFront);
PowerConsumer.ForcePosition[REAimplements.LeftRear] = {};
PowerConsumer.ForcePosition[REAimplements.LeftRear].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionLeftRearNode");
REAimplements:SetIsLeft(PowerConsumer,REAimplements.LeftRear);
PowerConsumer.ForcePosition[REAimplements.RightFront] = {};
PowerConsumer.ForcePosition[REAimplements.RightFront].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionRightFrontNode");
PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode = REAimplements:CreateNode(ParentNode,0,0,0,"GroundPositionLeftFrontNode");
REAimplements:SetIsRight(PowerConsumer,REAimplements.RightFront);
PowerConsumer.ForcePosition[REAimplements.RightRear] = {};
PowerConsumer.ForcePosition[REAimplements.RightRear].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionRightRearNode");
REAimplements:SetIsRight(PowerConsumer,REAimplements.RightRear);
else
PowerConsumer.ForcePosition[REAimplements.LeftFront] = {};
PowerConsumer.ForcePosition[REAimplements.LeftFront].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionLeftFrontNode");
PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode = REAimplements:CreateNode(ParentNode,0,0,0,"GroundPositionLeftFrontNode");
REAimplements:SetIsLeft(PowerConsumer,REAimplements.LeftFront);
PowerConsumer.ForcePosition[REAimplements.LeftRear] = {};
PowerConsumer.ForcePosition[REAimplements.LeftRear].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionLeftRearNode");
REAimplements:SetIsLeft(PowerConsumer,REAimplements.LeftRear);
PowerConsumer.ForcePosition[REAimplements.RightFront] = {};
PowerConsumer.ForcePosition[REAimplements.RightFront].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionRightFrontNode");
PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode = REAimplements:CreateNode(ParentNode,0,0,0,"GroundPositionLeftFrontNode");
REAimplements:SetIsRight(PowerConsumer,REAimplements.RightFront);
PowerConsumer.ForcePosition[REAimplements.RightRear] = {};
PowerConsumer.ForcePosition[REAimplements.RightRear].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionRightRearNode");
REAimplements:SetIsRight(PowerConsumer,REAimplements.RightRear);
end;
-- Save parent node
PowerConsumer.ForcePositionNode = ParentNode;
end;
-------------------------------------------------------part 2 of the code i changed and added---------------------------------------
function REAimplements:UpdatePositionOfForcePositions(ToolType,PowerConsumer,WorkAreas) local ParentNode = PowerConsumer.ForcePositionNode; local ,my, = getCenterOfMass(PowerConsumer.forceNode) if ToolType == REAimplements.Cultivator then local sX, sY, sZ = 0,0,0; local hX, hY, hZ = 0,0,0; local CultivatorDivider = 1; if PowerConsumer.ForcePositionNode ~= PowerConsumer.forceNode then sX, , sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0); wX, , wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0); hX, , hZ = localToLocal(WorkAreas[2].height,ParentNode,0,0,0); CultivatorDivider = 2; else sX, , sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0); wX, , wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0); hX, , hZ = localToLocal(WorkAreas[1].height,ParentNode,0,0,0); end;
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode,hX,my,hZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode,sX,my,sZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].Node,hX/CultivatorDivider,my,wZ/CultivatorDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftRear].Node,hX/CultivatorDivider,my,hZ/CultivatorDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].Node,wX/CultivatorDivider,my,wZ/CultivatorDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightRear].Node,wX/CultivatorDivider,my,hZ/CultivatorDivider);
else
local sX, _, sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0);
local wX, _, wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0);
local hX, _, hZ = localToLocal(WorkAreas[1].height,ParentNode,0,0,0);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode,sX,my,sZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode,wX,my,wZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].Node,sX,my,sZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftRear].Node,hX,my,hZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].Node,wX,my,wZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightRear].Node,wX,my,hZ);
end;
end;
Hello!
Enable REAimplements.Debug by setting it to TRUE and you should see where the new force positions is located.
//Hans
Från: Hilbert1982 @.> Skickat: den 4 april 2022 22:30 Till: 900hasse/FS22_REAimplements @.> Kopia: Hans Nordberg @.>; Comment @.> Ämne: Re: [900hasse/FS22_REAimplements] Shaking issue with speed-tiller 465 (Issue #2)
https://workupload.com/file/gvwERwwQu3A
— Reply to this email directly, view it on GitHub https://github.com/900hasse/FS22_REAimplements/issues/2#issuecomment-1087984524 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AXLRS67R7A6QKMDOSOWFHRDVDNGN5ANCNFSM5MY3Q5QA . You are receiving this because you commented. https://github.com/notifications/beacon/AXLRS62EJLONLEE4AQVJ44LVDNGN5A5CNFSM5MY3Q5QKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIDMVHDA.gif Message ID: @. @.> >
@Hilbert1982 the formatting of your code examples is broken
Did you mean something like this?
-----------------------------------------------------------------------------------
-- Function to create force positions
-----------------------------------------------------------------------------------
function REAimplements:CreateForcePositions(Vehicle,ToolType,PowerConsumer,WorkAreas)
-- Create force position table
PowerConsumer.ForcePosition = {};
local ParentNode = PowerConsumer.forceNode;
-- Create Force nodes
if ToolType == REAimplements.Plow then
local numWorkArea = table.getn(WorkAreas);
if numWorkArea > 1 then
-- Not nice... Only to get plows with two workareas to work :(
local HasTwoPlowareas = WorkAreas[2].type == WorkAreaType.PLOW;
if HasTwoPlowareas then
if Vehicle.spec_wheels ~= nil then
if Vehicle.spec_wheels.wheels ~= nil then
if table.getn(Vehicle.spec_wheels.wheels) > 1 then
local LargestRadius = 0;
local ActWheel;
for _,wheel in pairs(Vehicle.spec_wheels.wheels) do
if wheel.radiusOriginal > LargestRadius then
ActWheel = wheel;
LargestRadius = wheel.radiusOriginal;
end;
end;
-- Create parent for force positipn nodes
local ForceParent = createTransformGroup("ForceParent")
link(ActWheel.repr, ForceParent);
setTranslation(ForceParent,0,0,0);
setRotation(ForceParent,0,0,0);
setScale(ForceParent,1,1,1);
ParentNode = ForceParent;
REAimplements:PrintDebug("REA implements: " .. Vehicle:getFullName() .. " as a " .. REAimplements.ToolTypeNames[Vehicle.ToolType] .. " uses wheel as a reference")
end;
end;
end;
end;
end;
elseif ToolType == REAimplements.Cultivator then
local numWorkArea = table.getn(WorkAreas);
if numWorkArea > 1 then
-- Not nice... Only to get plows with two workareas to work :(
local HasTwoWorkareas = WorkAreas[2].type == WorkAreaType.CULTIVATOR;
if HasTwoWorkareas then
if Vehicle.spec_wheels ~= nil then
if Vehicle.spec_wheels.wheels ~= nil then
if table.getn(Vehicle.spec_wheels.wheels) > 1 then
local LargestRadius = 0;
local ActWheel;
for _,wheel in pairs(Vehicle.spec_wheels.wheels) do
if wheel.radiusOriginal > LargestRadius then
ActWheel = wheel;
LargestRadius = wheel.radiusOriginal;
end;
end;
-- Create parent for force positipn nodes
local ForceParent = createTransformGroup("ForceParent")
link(ActWheel.repr, ForceParent);
setTranslation(ForceParent,0,0,0);
setRotation(ForceParent,0,0,0);
setScale(ForceParent,1,1,1);
ParentNode = ForceParent;
REAimplements:PrintDebug("REA implements: " .. Vehicle:getFullName() .. " as a " .. REAimplements.ToolTypeNames[Vehicle.ToolType] .. " uses wheel as a reference")
end;
end;
end;
end;
end;
elseif ToolType == REAimplements.Roller then
local numWorkArea = table.getn(WorkAreas);
if numWorkArea > 1 then
-- Not nice... Only to get plows with two workareas to work :(
local HasTwoWorkareas = WorkAreas[2].type == WorkAreaType.ROLLER;
if HasTwoWorkareas then
if Vehicle.spec_wheels ~= nil then
if Vehicle.spec_wheels.wheels ~= nil then
if table.getn(Vehicle.spec_wheels.wheels) > 1 then
local LargestRadius = 0;
local ActWheel;
for _,wheel in pairs(Vehicle.spec_wheels.wheels) do
if wheel.radiusOriginal > LargestRadius then
ActWheel = wheel;
LargestRadius = wheel.radiusOriginal;
end;
end;
-- Create parent for force positipn nodes
local ForceParent = createTransformGroup("ForceParent")
link(ActWheel.repr, ForceParent);
setTranslation(ForceParent,0,0,0);
setRotation(ForceParent,0,0,0);
setScale(ForceParent,1,1,1);
ParentNode = ForceParent;
REAimplements:PrintDebug("REA implements: " .. Vehicle:getFullName() .. " as a " .. REAimplements.ToolTypeNames[Vehicle.ToolType] .. " uses wheel as a reference")
end;
end;
end;
end;
end;
PowerConsumer.ForcePosition[REAimplements.LeftFront] = {};
PowerConsumer.ForcePosition[REAimplements.LeftFront].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionLeftFrontNode");
PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode = REAimplements:CreateNode(ParentNode,0,0,0,"GroundPositionLeftFrontNode");
REAimplements:SetIsLeft(PowerConsumer,REAimplements.LeftFront);
PowerConsumer.ForcePosition[REAimplements.LeftRear] = {};
PowerConsumer.ForcePosition[REAimplements.LeftRear].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionLeftRearNode");
REAimplements:SetIsLeft(PowerConsumer,REAimplements.LeftRear);
PowerConsumer.ForcePosition[REAimplements.RightFront] = {};
PowerConsumer.ForcePosition[REAimplements.RightFront].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionRightFrontNode");
PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode = REAimplements:CreateNode(ParentNode,0,0,0,"GroundPositionLeftFrontNode");
REAimplements:SetIsRight(PowerConsumer,REAimplements.RightFront);
PowerConsumer.ForcePosition[REAimplements.RightRear] = {};
PowerConsumer.ForcePosition[REAimplements.RightRear].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionRightRearNode");
REAimplements:SetIsRight(PowerConsumer,REAimplements.RightRear);
else
PowerConsumer.ForcePosition[REAimplements.LeftFront] = {};
PowerConsumer.ForcePosition[REAimplements.LeftFront].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionLeftFrontNode");
PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode = REAimplements:CreateNode(ParentNode,0,0,0,"GroundPositionLeftFrontNode");
REAimplements:SetIsLeft(PowerConsumer,REAimplements.LeftFront);
PowerConsumer.ForcePosition[REAimplements.LeftRear] = {};
PowerConsumer.ForcePosition[REAimplements.LeftRear].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionLeftRearNode");
REAimplements:SetIsLeft(PowerConsumer,REAimplements.LeftRear);
PowerConsumer.ForcePosition[REAimplements.RightFront] = {};
PowerConsumer.ForcePosition[REAimplements.RightFront].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionRightFrontNode");
PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode = REAimplements:CreateNode(ParentNode,0,0,0,"GroundPositionLeftFrontNode");
REAimplements:SetIsRight(PowerConsumer,REAimplements.RightFront);
PowerConsumer.ForcePosition[REAimplements.RightRear] = {};
PowerConsumer.ForcePosition[REAimplements.RightRear].Node = REAimplements:CreateNode(ParentNode,0,0,0,"ForcePositionRightRearNode");
REAimplements:SetIsRight(PowerConsumer,REAimplements.RightRear);
end;
-- Save parent node
PowerConsumer.ForcePositionNode = ParentNode;
end;
-----------------------------------------------------------------------------------
-- Function to create force positions
-----------------------------------------------------------------------------------
function REAimplements:UpdatePositionOfForcePositions(ToolType,PowerConsumer,WorkAreas)
local ParentNode = PowerConsumer.ForcePositionNode;
local _,my,_ = getCenterOfMass(PowerConsumer.forceNode) -- typo or really meant to be like that?
if ToolType == REAimplements.Plow then
local sX, sY, sZ = 0,0,0;
local hX, hY, hZ = 0,0,0;
local PlowDivider = 1;
if PowerConsumer.ForcePositionNode ~= PowerConsumer.forceNode then
sX, _, sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0);
wX, _, wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0);
hX, _, hZ = localToLocal(WorkAreas[2].height,ParentNode,0,0,0);
PlowDivider = 2;
else
sX, _, sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0);
wX, _, wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0);
hX, _, hZ = localToLocal(WorkAreas[1].height,ParentNode,0,0,0);
end;
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode,hX,my,hZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode,sX,my,sZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].Node,hX/PlowDivider,my,wZ/PlowDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftRear].Node,hX/PlowDivider,my,hZ/PlowDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].Node,wX/PlowDivider,my,wZ/PlowDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightRear].Node,wX/PlowDivider,my,hZ/PlowDivider);
elseif ToolType == REAimplements.Cultivator then
local sX, sY, sZ = 0,0,0;
local hX, hY, hZ = 0,0,0;
local CultivatorDivider = 1;
if PowerConsumer.ForcePositionNode ~= PowerConsumer.forceNode then
sX, _, sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0);
wX, _, wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0);
hX, _, hZ = localToLocal(WorkAreas[2].height,ParentNode,0,0,0);
CultivatorDivider = 2;
else
sX, _, sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0);
wX, _, wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0);
hX, _, hZ = localToLocal(WorkAreas[1].height,ParentNode,0,0,0);
end;
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode,hX,my,hZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode,sX,my,sZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].Node,hX/CultivatorDivider,my,wZ/CultivatorDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftRear].Node,hX/CultivatorDivider,my,hZ/CultivatorDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].Node,wX/CultivatorDivider,my,wZ/CultivatorDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightRear].Node,wX/CultivatorDivider,my,hZ/CultivatorDivider);
elseif ToolType == REAimplements.Roller then
local sX, sY, sZ = 0,0,0;
local hX, hY, hZ = 0,0,0;
local RollerDivider = 1;
if PowerConsumer.ForcePositionNode ~= PowerConsumer.forceNode then
sX, _, sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0);
wX, _, wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0);
hX, _, hZ = localToLocal(WorkAreas[2].height,ParentNode,0,0,0);
CultivatorDivider = 2;
else
sX, _, sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0);
wX, _, wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0);
hX, _, hZ = localToLocal(WorkAreas[1].height,ParentNode,0,0,0);
end;
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode,hX,my,hZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode,sX,my,sZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].Node,hX/RollerDivider,my,wZ/RollerDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftRear].Node,hX/RollerDivider,my,hZ/RollerDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].Node,wX/RollerDivider,my,wZ/RollerDivider);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightRear].Node,wX/RollerDivider,my,hZ/RollerDivider);
else
local sX, _, sZ = localToLocal(WorkAreas[1].start,ParentNode,0,0,0);
local wX, _, wZ = localToLocal(WorkAreas[1].width,ParentNode,0,0,0);
local hX, _, hZ = localToLocal(WorkAreas[1].height,ParentNode,0,0,0);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].GroundTypeRefNode,sX,my,sZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].GroundTypeRefNode,wX,my,wZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftFront].Node,sX,my,sZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.LeftRear].Node,hX,my,hZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightFront].Node,wX,my,wZ);
setTranslation(PowerConsumer.ForcePosition[REAimplements.RightRear].Node,wX,my,hZ);
end;
end;
^...and it does not work.
Shaking issue with speed-tiller 465. Even little turning causes implement to shake and it stops after vehicle stops. I tested almost everything else and issue didn't happen in any other implements.
here is video for you to see whats happening: https://youtu.be/Fc41vv3oIrE
Otherwise your work and mods are game changer! Keep it up! Let me know if you open support page to patreon or via paypal.