1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
Blog Articles
  • Everywhere
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Blog
  3. Programming ABB robots, Rapid programming

Picking part 2, from a tray of parts.

  • Lemster68
  • November 4, 2019 at 3:41 PM
  • 5,178 times read

Here is the next article on picking parts with robtarget arrays, taught by one position then calculating the rest of the array. In this one, since it is a flat tray, I had to set the "Z" value the same. The improved part is writing the orient and axis configuration also. I hope you find it informative and useful. I think I got the code formatted better this time. I will have to revisit the first article to see if I can fix it.

Code
MODULE MD11
  !Pick Locations
  !Distance Between one row To the next
  !Distance from one column to the next
  !Current Column and Row
  LOCAL CONST num xToPart:=65;
  LOCAL CONST num yToPart:=45;
  LOCAL VAR num nXpos:=0;
  LOCAL PERS num nXOffs:=0;
  LOCAL CONST num nBlockXOffset:=0;
  LOCAL CONST num nBlockYOffset:=0;
  LOCAL VAR num nYpos:=0;
  LOCAL VAR num nYOffs:=0;
  PERS robtarget pPickTray_1_11{6,6}:=[[[[1.04,0.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.04,45.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.04,90.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.04,135.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.04,180.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.04,225.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-63.96,22.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.96,67.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.96,112.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.96,157.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.96,202.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.96,247.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-128.96,0.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.96,45.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.96,90.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.96,135.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.96,180.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.96,225.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-193.96,22.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.96,67.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.96,112.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.96,157.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.96,202.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.96,247.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-258.96,0.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.96,45.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.96,90.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.96,135.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.96,180.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.96,225.3,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-323.96,22.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.96,67.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.96,112.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.96,157.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.96,202.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.96,247.8,2.39],[0.00357907,-0.602141,-0.798381,-0.000831899],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]];
  PERS robtarget pPickTray_2_11{6,6}:=[[[[1.63,0.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.63,45.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.63,90.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.63,135.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.63,180.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[1.63,225.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-63.37,22.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.37,67.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.37,112.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.37,157.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.37,202.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-63.37,247.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-128.37,0.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.37,45.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.37,90.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.37,135.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.37,180.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-128.37,225.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-193.37,22.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.37,67.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.37,112.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.37,157.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.37,202.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-193.37,247.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-258.37,0.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.37,45.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.37,90.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.37,135.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.37,180.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-258.37,225.08,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]
  ,[[[-323.37,22.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.37,67.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.37,112.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.37,157.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.37,202.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-323.37,247.58,2.62],[0.00228484,-0.601805,-0.798639,-0.000969585],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]]];
  PERS robtarget pMBC_Bolt_11{14}:=[[[-143.95,-1.56,11.13],[0.000422986,-0.678748,-0.734372,-0.000684052],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[0.42,-1.11,9.36],[0.00011312,0.696077,0.717969,-0.000511345],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[0.02,154.03,9.18],[0.000423889,-0.678709,-0.734409,-0.000699308],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-146.57,154,9.58],[0.000452797,-0.678693,-0.734424,-0.000754183],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-146.81,307,10.95],[0.000454415,-0.678662,-0.734452,-0.000735513],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-1.12,307,9.54],[0.000362283,-0.678006,-0.735056,-0.00164912],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-0.24,462.16,9.87],[0.00050814,-0.678627,-0.734484,-0.000822217],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-146.9,462.59,10.78],[0.00165613,0.67762,0.735387,0.00615585],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-145.43,615.39,9.42],[0.00170342,0.677583,0.735421,0.00612978],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[0.04,615.03,10.47],[0.00168147,0.677589,0.735415,0.0061453],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-0.27,769.56,9.79],[0.00165907,0.677605,0.7354,0.00620951],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-146.13,770.02,9.65],[0.00168382,0.677557,0.735444,0.00613617],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-143.96,923.03,10.21],[0.0016778,0.677522,0.735476,0.00618139],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-0.14,923.10,10.80],[0.00163365,0.677494,0.735502,0.00617596],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]];
  CONST robtarget pOilJetMD11{6}:=[[[-416.25,1230.6,238],[0.000201512,0.998154,-0.060692,0.00203478],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-261.75,1230.62,237.99],[0.000201512,0.998154,-0.060692,0.00203478],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[-108,1231.2,238],[0.000201512,0.998154,-0.060692,0.00203478],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[46.25,1230.7,238.23],[0.000211835,0.998155,-0.0606785,0.00203977],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[200.75,1229.5,238],[0.000201512,0.998154,-0.060692,0.00203478],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[354.5,1230.5,238.25],[0.000201512,0.998154,-0.060692,0.00203478],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]];
  LOCAL PERS num nStepPick{12}:=[1,-2,3,-2,5,-2,7,-2,9,-2,11,-2];
  LOCAL PERS num nStepPlace{12}:=[-2,2,-2,4,-2,6,-2,8,-2,10,-2,12];
  LOCAL PERS num nStepCheck{12}:=[1,2,3,4,5,6,7,8,9,10,11,12];
  LOCAL PERS num nStepLoosen{14}:=[1,2,3,4,5,6,7,8,9,10,11,12,13,14];
  
  PROC rMD11_Tray1()
    VAR num NumTries;
    VAR bool bTimeOut;
    CONST errnum erNotClosed1:=99;
    CONST errnum erNoPartPres:=97;
    CONST errnum erNoPartPresent:=96;
    
    IF bLastPick_11_1 THEN
      TPErase;
      TPWrite "Waiting for MD11 Tray 1 OK.";
      WaitUntil fiMD11Tray_1_OK=ON;
      !IF  fiNewTray_11_1=ON ResetTray_1MD11;
    ENDIF
    WaitUntil fiMD11Tray_1_OK=1\Maxtime:=FAULT_TIME\TimeFlag:=bTimeout;
    IF bTimeOut RAISE ERR_NO_TRAY;    
lblNextTry:
    TPErase;
    TPWrite "*************************************";
    TPWrite "Picking from MD11 Tray 1,";
    TPWrite "From Row:="\Num:=nRow_1_11;
    TPWrite "And Column:="\Num:=nColumn_1_11;
    TPWrite "*************************************";
    IF diJetPresent = 0 AND diJetClamped = 0 THEN
      rChkGripperOpen;
      Reset foClearMD11_T1;
      MoveL Offs(pPickTray_1_11{nRow_1_11,nColumn_1_11},0,0,40), v500, z1\Inpos:=Inpos90, tCool_Jet\WObj:=wobjMD11Tray_1;
      Set foRunSearch;
      MoveL pPickTray_1_11{nRow_1_11,nColumn_1_11}, v40, fine, tCool_Jet\WObj:=wobjMD11Tray_1;
      Reset foRunSearch;
      IF fiDryCycle = 1 THEN
          rCloseGripper;
      ELSE
          rCloseGripper\swWithPart;
      ENDIF
      rContinue;
      SetDO foInPosition, OFF;
      WaitDO foInPosition, OFF;
      MoveL Offs(pPickTray_1_11{nRow_1_11,nColumn_1_11},0,0,80), v300, z5\Inpos:=Inpos95, tCool_Jet\WObj:=wobjMD11Tray_1;
      IF fiDryCycle = 0 rCheckPartPres\swOn;
      Incr nTray11_1_Noflt{nRow_1_11,nColumn_1_11};
      rIndexMD11_1;
      Set foPlaceDone;
      Set foClearMD11_T1;
    ELSE
      IF diJetPresent=1 RETURN;
    ENDIF
    RETURN;
  ERROR
    ! erNoPartPres is raised from the
    ! CloseGripper routine
    ! erNoPartPresent is raised from the
    ! checkpartpresent routine
    TEST ERRNO
    CASE erNoPartPresent:
      rAlarmScreen(ERR_NOPART);
        IF fiDiscardPart = OFF THEN
          Incr nTray11_1_flt{nRow_1_11,nColumn_1_11};
             RETRY;
        ELSE
          Reset foRunSearch;
          Incr nTray11_1_flt{nRow_1_11,nColumn_1_11};
          pTemp := CRobT(\Tool:=tCool_Jet\WObj:=wobjMD11Tray_1);
          MoveL pDropReject, v400, fine, tCool_Jet;
          rOpenGripper;
          rIndexMD11_1;
          !Set foPartRejected;
          IF bLastPick_11_1 = TRUE ExitCycle;
          MoveL pTemp, v400, fine, tCool_Jet\WObj:=wobjMD11Tray_1;
          MoveL Offs(pPickTray_1_11{nRow_1_11,nColumn_1_11},0,0,40), v400, z1\Inpos:=Inpos95, tCool_Jet\WObj:=wobjMD11Tray_1;
          Set foRunSearch;
          MoveL pPickTray_1_11{nRow_1_11,nColumn_1_11}, v40, fine, tCool_Jet\WObj:=wobjMD11Tray_1;
          Reset foRunSearch;
          rCloseGripper;
          SetDO foInPosition, OFF;
          MoveL Offs(pPickTray_1_11{nRow_1_11,nColumn_1_11},0,0,80), v200, z1, tCool_Jet\WObj:=wobjMD11Tray_1;
          RETRY;
        ENDIF
      CASE erNoPartPres:
        IF NumTries=3 THEN
          rOpenGripper;
          TPWrite "Part unable to be located";
          MoveL Offs(pPickTray_1_11{nRow_1_11,nColumn_1_11},0,0,80), v400, z1, tCool_Jet\WObj:=wobjMD11Tray_1;
          MoveL Offs(pPickTray_1_11{nRow_1_11,1},0,0,200), v500, fine, tCool_Jet\WObj:=wobjMD11Tray_1;
          Set foClearMD11_T1;
          IF fiIgnoreCountErr = OFF THEN
              rAlarmScreen ERR_PART_RETRY_EXC;
              !IF  fiNewTray_11_1=ON ResetTray_1MD11;
              NumTries := 0;
              ResetRetryCount;
              Set foClearMD11_T1;
              Set foClearOfBlock;
              RAISE;
          ELSE
              NumTries := 0;
              ResetRetryCount;
              RETRY;
          ENDIF
        ELSE
          rOpenGripper;
          MoveL Offs(pPickTray_1_11{nRow_1_11,nColumn_1_11},0,0,40), v400, z1, tCool_Jet\WObj:=wobjMD11Tray_1;
          Incr NumTries;
          rIndexMD11_1;
          IF bLastPick_11_1 = TRUE ExitCycle;
          MoveL Offs(pPickTray_1_11{nRow_1_11,nColumn_1_11},0,0,40), v400, z1\Inpos:=Inpos95, tCool_Jet\WObj:=wobjMD11Tray_1;
          Set foRunSearch;
          MoveL pPickTray_1_11{nRow_1_11,nColumn_1_11}, v40, fine, tCool_Jet\WObj:=wobjMD11Tray_1;
          Reset foRunSearch;
          RETRY;
        ENDIF
      CASE ERR_NO_TRAY:
        RAISE;      
      DEFAULT:
        ! An unanticipated error has occurred.
        rAlarmScreen(ERR_NOT_DEFINED);
        STOP;      
    ENDTEST
  ENDPROC

  PROC rMD11_Tray2()
    VAR num NumTries;
    VAR bool bTimeOut;
    CONST errnum erNotClosed1:=99;
    CONST errnum erNoPartPres:=97;
    CONST errnum erNoPartPresent:=96;
    
    IF bLastPick_11_2 THEN
      TPErase;
      TPWrite "Waiting for MD11 Tray 2 OK.";
      WaitUntil fiMD13Tray_2_OK=ON;
      !IF  fiNewTray_11_2=ON ResetTray_2MD11;
    ENDIF
    WaitUntil fiMD11Tray_2_OK=1\Maxtime:=FAULT_TIME\TimeFlag:=bTimeout;
    IF bTimeOut RAISE ERR_NO_TRAY;     
lblNextTry:
    TPErase;
    TPWrite "*************************************";
    TPWrite "Picking from MD11 Tray 2";
    TPWrite "From Row:="\Num:=nRow_2_11;
    TPWrite "And Column:="\Num:=nColumn_2_11;
    TPWrite "*************************************";
    IF diJetPresent = 0 AND diJetClamped = 0 THEN
      Reset foClearMD11_T2;
      rChkGripperOpen;
      ! MoveL Offs(pPickTray_2_11{nRow_2_11,1},0,0,200), v500, z20, tCool_Jet\WObj:=wobjMD11Tray_2;
      MoveL Offs(pPickTray_2_11{nRow_2_11,nColumn_2_11},0,0,40), v400, z1\Inpos:=Inpos95, tCool_Jet\WObj:=wobjMD11Tray_2;
      Set foRunSearch;
      MoveL pPickTray_2_11{nRow_2_11,nColumn_2_11}, v40, fine, tCool_Jet\WObj:=wobjMD11Tray_2;
      Reset foRunSearch;
      IF fiDryCycle = 1 THEN
          rCloseGripper;
      ELSE
          rCloseGripper\swWithPart;
      ENDIF
      rContinue;
      SetDO foInPosition, OFF;
      MoveL Offs(pPickTray_2_11{nRow_2_11,nColumn_2_11},0,0,80), v200, z1, tCool_Jet\WObj:=wobjMD11Tray_2;
      IF fiDryCycle = 0 rCheckPartPres\swOn;
      Incr nTray11_2_Noflt{nRow_2_11,nColumn_2_11};
      rIndexMD11_2;
      Set foPlaceDone;
      ! MoveL Offs(pPickTray_2_11{nRow_2_11,1},0,0,150), v150, z5\Inpos:=Inpos95, tCool_Jet\WObj:=wobjMD11Tray_2;
      Set foClearMD11_T2;
    ELSE
      IF diJetPresent=1 RETURN;
    ENDIF
    RETURN;
  ERROR
    ! erNoPartPres is raised from the
    ! CloseGripper routine
    ! erNoPartPresent is raised from the
    ! checkpartpresent routine
    TEST ERRNO
    CASE erNoPartPresent:
      rAlarmScreen(ERR_NOPART);
        IF fiDiscardPart = OFF THEN
          Incr nTray11_2_flt{nRow_2_11,nColumn_2_11};
             RETRY;
        ELSE
      tTemp:=CTool();
      WObjTemp:=CWObj();
      pTemp:=CRobT(\Tool:=tTemp\WObj:=wobjTemp);
          Reset foRunSearch;
          Incr nTray11_2_flt{nRow_2_11,nColumn_2_11};
          MoveL pDropReject, v400, fine, tCool_Jet;
          rOpenGripper;
          rIndexMD11_2;
          !Set foPartRejected;
          MoveL pTemp, v400, fine, tCool_Jet\WObj:=wobjMD11Tray_2;
          IF bLastPick_11_2 = TRUE ExitCycle;
          MoveL Offs(pPickTray_2_11{nRow_2_11,nColumn_2_11},0,0,40), v400, z1\Inpos:=Inpos95, tCool_Jet\WObj:=wobjMD11Tray_2;
          Set foRunSearch;
          MoveL pPickTray_2_11{nRow_2_11,nColumn_2_11}, v40, fine, tCool_Jet\WObj:=wobjMD11Tray_2;
          Reset foRunSearch;
          rCloseGripper;
          Reset foPartRejected;
          SetDO foInPosition, OFF;
          MoveL Offs(pPickTray_2_11{nRow_2_11,nColumn_2_11},0,0,80), v200, z1, tCool_Jet\WObj:=wobjMD11Tray_2;
          RETRY;
        ENDIF
      CASE erNoPartPres:
        IF NumTries=3 THEN
          Reset foRunSearch;
          rOpenGripper;
          TPWrite "Part unable to be located";
          MoveL Offs(pPickTray_2_11{nRow_2_11,nColumn_2_11},0,0,40), v400, z1, tCool_Jet\WObj:=wobjMD11Tray_2;
          MoveL Offs(pPickTray_2_11{nRow_2_11,1},0,0,200), v500, fine, tCool_Jet\WObj:=wobjMD11Tray_2;
          Set foClearMD11_T2;
          IF fiIgnoreCountErr = OFF THEN
              rAlarmScreen ERR_PART_RETRY_EXC;
              !IF  fiNewTray_11_2=ON ResetTray_2MD11;
              NumTries := 0;
              ResetRetryCount;
              Set foClearMD11_T2;
              Set foClearOfBlock;
              RAISE;
          ELSE
              NumTries := 0;
              ResetRetryCount;
              RETRY;
          ENDIF
        ELSE
          rOpenGripper;
          MoveL Offs(pPickTray_2_11{nRow_2_11,nColumn_2_11},0,0,40), v400, z1, tCool_Jet\WObj:=wobjMD11Tray_2;
          Incr NumTries;
          rIndexMD11_2;
          IF bLastPick_11_2 ExitCycle;
          MoveL Offs(pPickTray_2_11{nRow_2_11,nColumn_2_11},0,0,40), v400, z1\InPos:=Inpos95, tCool_Jet\WObj:=wobjMD11Tray_2;
          Set foRunSearch;
          MoveL pPickTray_2_11{nRow_2_11,nColumn_2_11}, v40, fine, tCool_Jet\WObj:=wobjMD11Tray_2;
          Reset foRunSearch;
          RETRY;
        ENDIF
      CASE ERR_NO_TRAY:
        RAISE;      
      DEFAULT:
        ! An unanticipated error has occurred.
        rAlarmScreen(ERR_NOT_DEFINED);
        STOP;      
    ENDTEST
  ENDPROC

  PROC rIndexMD11_1()
    !Gets Current Part Location and Indexes Position to next part
    !Find out if last row is being picked
    IF nRow_1_11>=6 AND nColumn_1_11=6 bLastPick_11_1:=TRUE;
    IF bLastPick_11_1 Set foMD11Tray1Empty;
    IF nRow_1_11<=6 AND nColumn_1_11<6 THEN
      Incr nColumn_1_11;
    ELSEIF nRow_1_11<=5 AND nColumn_1_11=6 THEN
      Incr nRow_1_11;
      nColumn_1_11:=1;
    ENDIF
  ENDPROC

  PROC rIndexMD11_2()
    !Gets Current Part Location and Indexes Position to next part
    !Find out if last row is being picked
    IF nRow_2_11 >= 6 AND nColumn_2_11 = 6 bLastPick_11_2:=TRUE;
    IF bLastPick_11_2 Set foMD11Tray2Empty;
    IF nRow_2_11<=6 AND nColumn_2_11<6 THEN
      Incr nColumn_2_11;
    ELSEIF nRow_2_11<=5 AND nColumn_2_11=6 THEN
      Incr nRow_2_11;
      nColumn_2_11:=1;
    ENDIF
  ENDPROC

  PROC rTeachTray_1MD11()
    VAR num nDummy := 0;
    !Procedure for teaching the Right pick position
    MoveJ pPickTray_1_11{1,1}, v100, fine, tCool_Jet\WObj:=wobjMD11Tray_1;
    TPReadFK nDummy, "Apply this position modification to all subsequent positions?", "YES", stEmpty, stEmpty, stEmpty, "NO";
    TEST nDummy
    CASE 1:
        FOR i FROM 1 TO 6 DO
          FOR j FROM 1 TO 6 DO
            pPickTray_1_11{i,j}.trans.y:=pPickTray_1_11{1,1}.trans.y+((j-1)*yToPart);
            IF (i=2) OR (i=4) OR (i=6) pPickTray_1_11{i,j}.trans.y:=pPickTray_1_11{i,j}.trans.y + 22.5;
          ENDFOR
        ENDFOR
        FOR i FROM 1 TO 6 DO
          FOR j FROM 1 TO 6 DO
            pPickTray_1_11{i,j}.trans.x:=pPickTray_1_11{1,1}.trans.x-((i-1)*xToPart);
            pPickTray_1_11{i,j}.trans.z:=pPickTray_1_11{1,1}.trans.z;
            pPickTray_1_11{i,j}.rot:=pPickTray_1_11{1,1}.rot;
            pPickTray_1_11{i,j}.robconf:=pPickTray_1_11{1,1}.robconf;
          ENDFOR
        ENDFOR
    DEFAULT:
        ! Do nothing.  All other positions in the array go unchanged.
    ENDTEST
  ENDPROC
  
  PROC rTeachTray_2MD11()
    VAR num nDummy := 0;
    !Procedure for teaching the Left pick position
    MoveL pPickTray_2_11{1,1}, v100, fine, tCool_Jet\WObj:=wobjMD11Tray_2;
    TPReadFK nDummy, "Apply this position modification to all subsequent positions?", "YES", stEmpty, stEmpty, stEmpty, "NO";
    TEST nDummy
    CASE 1:
        FOR i FROM 1 TO 6 DO
          FOR j FROM 1 TO 6 DO
            pPickTray_2_11{i,j}.trans.y:=pPickTray_2_11{1,1}.trans.y+((j-1)*yToPart);
            ! here alternating rows were offset, it looks like this:
            ! x x x x x x
            !  x x x x x x
            ! x x x x x x
            !  x x x x x x
            IF (i=2) OR (i=4) OR (i=6) pPickTray_2_11{i,j}.trans.y:=pPickTray_2_11{i,j}.trans.y + 22.5;
          ENDFOR
        ENDFOR
        FOR i FROM 1 TO 6 DO
          FOR j FROM 1 TO 6 DO
           pPickTray_2_11{i,j}.trans.x:=pPickTray_2_11{1,1}.trans.x-((i-1)*xToPart);
            pPickTray_2_11{i,j}.trans.z:=pPickTray_2_11{1,1}.trans.z;
            pPickTray_2_11{i,j}.rot:=pPickTray_2_11{1,1}.rot;
            pPickTray_2_11{i,j}.robconf:=pPickTray_2_11{1,1}.robconf;
           ENDFOR
        ENDFOR
    DEFAULT:
        ! Do nothing.  All other positions in the array go unchanged.
    ENDTEST
  ENDPROC

    PROC rMD11_1_Man_Set()
        VAR num nDummy := 0;
        TPReadFK nDummy, "Would you like to choose the start      position MD11 tray 1?", "YES", stEmpty, stEmpty, stEmpty, "NO";
        TEST nDummy
        CASE 1:
            lblRetryRow:
            TPReadNum nDummy, "Please enter row 1-6 on keypad.";
            TEST nDummy
            CASE 1,2,3,4,5,6:
                nRow_1_11 := nDummy;
            DEFAULT:
                TPWrite "I'm sorry, that response is not valid.";
                GOTO lblRetryRow;
            ENDTEST
            lblRetryColumn:
            TPReadNum nDummy, "Please enter column 1-6 on keypad.";
            TEST nDummy
            CASE 1,2,3,4,5,6:
                nColumn_1_11 := nDummy;
            DEFAULT:
                TPWrite "I'm sorry, that response is not valid.";
                GOTO lblRetryColumn;
            ENDTEST
        DEFAULT:
            MoveL Offs(pPickTray_1_11{nRow_1_11,1},0,0,250), v200, z1, tCool_Jet\WObj:=wobjMD11Tray_1;
            MoveJ pMD11Pounce, v3000, z200, tCool_Jet;
            ExitCycle;
        ENDTEST
    ENDPROC

    PROC rMD11_2_Man_Set()
        VAR num nDummy := 0;
        TPReadFK nDummy, "Would you like to choose the start      position MD11 tray 2?", "YES", stEmpty, stEmpty, stEmpty, "NO";
        TEST nDummy
        CASE 1:
            lblRetryRow:
            TPReadNum nDummy, "Please enter row 1-6 on keypad.";
            TEST nDummy
            CASE 1,2,3,4,5,6:
                nRow_2_11 := nDummy;
            DEFAULT:
                TPWrite "I'm sorry, that response is not valid.";
                GOTO lblRetryRow;
            ENDTEST
            lblRetryColumn:
            TPReadNum nDummy, "Please enter column 1-6 on keypad.";
            TEST nDummy
            CASE 1,2,3,4,5,6:
                nColumn_2_11 := nDummy;
            DEFAULT:
                TPWrite "I'm sorry, that response is not valid.";
                GOTO lblRetryColumn;
            ENDTEST
        DEFAULT:
            MoveL Offs(pPickTray_2_11{nRow_1_11,1},0,0,250), v200, z1, tCool_Jet\WObj:=wobjMD11Tray_2;
            MoveJ pMD11Pounce, v3000, z200, tCool_Jet;
            ExitCycle;
        ENDTEST
        RETURN;
    ENDPROC
Display More
  • Share
  • Previous Article Picking from a cart of parts
  • Next Article A program that can write a program!

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Categories

  • ABB Robotics
  • General Industrial Robotics

Archive

  1. 2020 (4)
    1. May (1)
    2. March (1)
    3. January (2)
  2. 2019 (3)
    1. November (3)
      • A program that can write a program!
      • Picking part 2, from a tray of parts.
      • Picking from a cart of parts

Tags

  • Programming
  • abb
  • RAPID
  • picking parts
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download