RobotStudio event

Calculated offset?

I'm attempting to use an incremented counter in a part laydown routine to calculate/modify an offset as I stack parts into a hopper. I need to the laydown position to shift 15mm in the +Z direction after each part, but I don't want to use dozens of robtargets to do it. One robtarget and a calculated offset based on a counter seems much cleaner, I just can't figure out how to do it.
Is there a way to use the counter to modify or select the offset I want?

Comments

  • You can just use a FOR or WHILE loop and every iteration increment the offset. With the function Offs you can modify the position.

    So you can do something like this: 

    <div>PERS num noParts := 5;
    </div><div>PERS num offset := 15;
    </div><div>PERS robtarget pFirst := [[1000,0,400],[0,1,0,0],[0,0,0,0],[9e9,9e9,9e9,9e9,9e9,9e9]];
    
    </div><div>PROC main()
    
    </div><div>  VAR num totalOffset := 0;
    
    </div><div>  FOR i FROM 1 TO noParts DO
    </div><div>    MoveJ Offs(pFirst,0,0,totalOffset), v1000, fine, tool0;
    </div><div>    totalOffset := totalOffset + offset;
    </div><div>  ENDFOR
    <br>ENDPROC
    
    </div>
  • ColoradoPacific
    edited August 2016
    That's quite a bit cleaner than what I ended up doing. Might have to go back and modify...

     Incr HopperCount;
                MoveAbsJ jposHOME,v1000,z50,tGripper;
                TEST HopperCount
                    CASE 1:
                    p1000Ct_PlacePos.trans.z := + 15;
                    p1000Ct_PlaceDepart.trans.z := + 15;
                    CASE 2:
                    p1000Ct_PlacePos.trans.z := + 30;
                    p1000Ct_PlaceDepart.trans.z := + 30;
                    CASE 3:
                    p1000Ct_PlacePos.trans.z := + 45;
                    p1000Ct_PlaceDepart.trans.z := + 45;
    etc, etc...

    Then reset the Z values at completion of the routine.