RobotStudio event

Index through robtargets

Options
scottMHA
scottMHA
edited February 2019 in RAPID Programming
is it possible to index through robtagets in a FOR statement? See example below, the argument Pick+i should reference the robtarget Pick1, Pick2 etc....

CONST robtarget Pick1;
CONST robtarget Pick2;
CONST robtarget Pick3;
CONST robtarget Pick4;

FOR i FROM 1 TO 4 DO
 !
 Pick i, Pick+i;
 !
 Drop;
 !
ENDFOR

PROC Pick(num PickNum,robtarget pickLoc)
 !
 MoveJ RelTool(pickLoc,0,0,200),vmax,z10,t_Gripper_16;
 !
 MoveL pickLoc,vmax,fine,t_Gripper_16\WObj:=wobj0;
 !
ENDPROC
Tagged:

Comments

  • lemster68
    Options
    Put your robtargets into an array.  Make a separate routine so you can make touchups or you have to view in the data to modpos them.
    Lee Justice
  • Micky
    Micky ✭✭✭
    Options
    Hello,
    you could use the instruction GetDataVal to retrieve the required robtarget.
    Proc Pick(string Name, num Index)
      var robtarget pTemp;
      var string stName;
      stName:=Name+Valtostr(Index);
      GetDatval stname, pTemp;
    
      MoveL pTemp,...;
    endproc
    /BR
    Micky
  • scottMHA
    Options
    Micky said:
    Hello,
    you could use the instruction GetDataVal to retrieve the required robtarget.
    Proc Pick(string Name, num Index)
      var robtarget pTemp;
      var string stName;
      stName:=Name+Valtostr(Index);
      GetDatval stname, pTemp;
    
      MoveL pTemp,...;
    endproc
    /BR
    Micky
    Perfect!