Skip to content

Commit 978aa02

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 dba0545 commit 978aa02

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
@@ -466,6 +466,9 @@ You can define the following custom settings:
466466
shovelMovingToolIx = "1"
467467
/>
468468

469+
<Vehicle name="highDumpBucket.xml"
470+
shovelMovingToolIx="1"/>
471+
469472
<!--[DLC]-->
470473

471474
<!--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)