Hi Dh,
I imagine you need to place parts into an ordinated scheme, say n rows by m lines. We usually refer to such a scheme as a “pallet”, and the entire task as “pallettizing” parts.
The problem is usually to maintain the number of position below a reasonable level, because pallettizing parts in a 10 by 10 pattern will require - in principle - 100 positions.
Worse, you’ll probably need at least two “fly-by” positions to reach the placing point ad to get back, so now we have 300 positions.
Let’s start from the 1 position pick-place cycle. You’ll have something like that:
MoveJ pHome, v100, fine, tool1;
WHILE TRUE DO
! Pick
MoveJ offs(pPick, 0,0,100), vmax, z10, tool1Wobj:=woPick;
MoveL pPick, v100, fine, tool1Wobj:=woPick;
Set doGrab;
WaitTime 1;
MoveL offs(pPick, 0,0,100), v100, z10, tool1Wobj:=woPick;
! Place
MoveJ offs(pPlace, 0,0,100), vmax, z10, tool1Wobj:=woPlace;
MoveL pPlace, v100, fine, tool1Wobj:=woPlace;
Reset doGrab;
WaitTime 1;
MoveL offs(pPlace, 0,0,100), v100, z10, tool1Wobj:=woPlace;
ENDWHILE
In this example, I use the offs function to build “fly-by” positions directly in the program. This allows me to:
- save some positions
- fly-by positions follow pPick and pPlace if the user change them.
Now, the easiest way to create a pallettizing pattern, is offseting pPlace with predefined X and Y deltas.
CONST num dx:=50;
CONST num dy:=50;
VAR num i:=0;
VAR num j:=0;
MoveJ pHome, v100, fine, tool1;
WHILE TRUE DO
! Pick
MoveJ offs(pPick, 0,0,100), vmax, z10, tool1Wobj:=woPick;
MoveL pPick, v100, fine, tool1Wobj:=woPick;
Set doGrab;
WaitTime 1;
MoveL offs(pPick, 0,0,100), v100, z10, tool1Wobj:=woPick;
! Place
MoveJ offs(pPlace, idx,jdy,100), vmax, z10, tool1Wobj:=woPlace;
MoveL offs(pPlace, idx,jdy,0), v100, fine, tool1Wobj:=woPlace;
Reset doGrab;
WaitTime 1;
MoveL offs(pPlace, idx,jdy,100), v100, z10, tool1Wobj:=woPlace;
i:=i+1;
IF i>=10 THEN
i:=0;
j:=j+1;
ENDIF
IF j>=10 THEN
! Pallet complete
STOP;
i:=0;
j:=0;
ENDIF
ENDWHILE
First, this program has the drawback that pPlace cannot be easily modified.
Second, if you need to “tune” positions (tipically to keep the pallet tight), you’ll need a lot of extra-code.
The solution is using a persistent matrix of positions, in the form pPlace{i,j}. Usually I put a procedure to calculate all the positions, using offsets in two nested FOR loops. Next, I (or the user) can modify the elements in the matrix even one by one. Fly-by position will automatically follow.
I hope this will help you.
Claudio