Hey guys, I am trying to do palletizing with for loops and I am using R and PR for my positions and offsets and here is how I implemented it (for simplicity, I will use only X)
FOR R[7:XCount] = 1 TO 5
L PR[30:ApproachPoint] 100mm/sec:FINE
L PR[31:PickupPoint] 100mm/sec:FINE
L PR[32:RetrievePoint] 100mm/sec:FINE
PR[30, 1:ApproachPoint] = PR[30, 1:ApproachPoint] + R[1:dX]
PR[31, 1:PickupPoint] = PR[31, 1:PickupPoint] + R[1:dX]
PR[32, 1:RetrievePoint] = PR[32, 1:RetrievePoint] + R[1:dX]
ENDFOR
PR[30, 1:ApproachPoint] = (PR[30, 1:ApproachPoint] - (R[7:XCount] * R[1:dX]))
PR[31, 1:PickupPoint] = (PR[31, 1:PickupPoint] - (R[7:XCount] * R[1:dX]))
PR[32, 1:RetrievePoint] = (PR[32, 1:RetrievePoint] - (R[7:XCount] * R[1:dX]))
END
Display More
The robot moves as expected, but as you can see at the end of the program, I am restoring the original X coordinate by recalculating its value, because if I don't and I play the program again the robot will nto start from the first point, but it will start from where it stopped, the original PR is lost.
So my question is, is there a better way to do this?
What if I add Y and Z, then I will have 9 additional rows to recalculate the original position, is there a way to do X Y Z offset calculation on a single row?
What if I have more than 3 points, things will quickly get out of hand, how do I approach this issue?