Skip to content

Commit 3232903

Browse files
committed
Should fix
Test a few wheel loader, frontloader and skid loaders. - The commands: `cpShovelPositionsSetState 1` and `cpShovelPositionsSetState 3` should be sufficient
1 parent 721ea75 commit 3232903

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

config/VehicleConfigurations.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ You can define the following custom settings:
455455
shovelMovingToolIx = "1"
456456
/>
457457

458+
<Vehicle name="highDumpBucket.xml"
459+
shovelMovingToolIx="1"/>
460+
458461
<!--[DLC]-->
459462

460463
<!--Harvester-->

scripts/specializations/CpShovelPositions.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,16 @@ function CpShovelPositions:setShovelPosition(dt, shovelLimits, armLimits, height
448448
--- Controls the arm height
449449
setTranslation(armProjectionNode, 0, i1y, i1z)
450450
setTranslation(armToolRefNode, ax, ay, az)
451+
451452
local _, shy, shz = localToLocal(shovelTool.node, armVehicle.rootNode, 0, 0, 0)
453+
local _, _, rz = localRotationToLocal(getParent(shovelTool.node), getParent(getParent(shovelTool.node)), 0, 0, 0)
452454
local dirZ, dirY = MathUtil.vector2Normalize(shz - az, shy - ay)
455+
if math.abs(rz) > math.rad(160) then
456+
--- We assume the shovel node is rotated by 180 degrees,
457+
--- so we have to flip the calculation
458+
dirZ, dirY = MathUtil.vector2Normalize(az - shz, ay - shy)
459+
end
460+
453461
oldRotRelativeArmRot = MathUtil.getYRotationFromDirection(-dirZ, dirY) + math.pi/2
454462

455463
alpha = math.atan2(i1y - ay, i1z - az)

0 commit comments

Comments
 (0)