RobotStudio event

New to syntax



Hi,
I am completely new to RAPID programming. I have experience in C and C+ and have recently began a project whihc requires me to use to IRB 120 robot manipulator. I have approximately 4000 points. Obviously, using the teach pendant only would be very tedious and unfortunately, the RobotStudio software is down at my university right now so I am left to programming the robot using a RAPID file. My questions are:
1) Is it possible to program an array of positions and cycle through them? For example, xPos = {xPos(1), xPos(2), ..., xPos(n)} within a for loop while n is increased each iteration.

2) If 1 is not possible, is it possible to increment a position variable each iteration? yPos = yPos + 40, or something along those lines.

I am trying to simplify my work a bit by not manually going to all 3900 points with the teach pendant and instead use an iterative approach with multiple FOR loops. Sorry for the long post.
Thanks for any help, advice, or where I can find it. I can upload a sample of what I have if that is required.
 

TL;DR: I need help incrementing a position variable each iteration through a FOR loop as partof a predetermined workspace.


  

Comments



  • Both are possible.
    1) An example of the FOR instuction:
     
    FOR i FROM 10 TO 2 STEP -2 DO
    a{i} := a{i-1};
    ENDFOR
     
     
    2) For the increment you can use a{i}:= Offs(a{i},0,0,0);
     
    Offs (Point XOffset YOffset ZOffset)
    Point
    Data type:

    robtarget


    The position data to be displaced.
    XOffset
    Data type:

    num


    The displacement in the x-direction, in the object coordinate system.
    YOffset
    Data type:

    num


    The displacement in the y-direction, in the object coordinate system.
    ZOffset
    Data typenumThe displacement in the z-direction, in the object coordinate system.
  • What is the proper way to declare an array? This is what I have to place in that array.

    CONST array rackPos{n}:=[rackPos{1}, rackPos{2}, rackPos{3}, rackPos{4}, rackPos{5}, rackPos{6}, rackPos{7}, rackPos{8}, rackPos{9}, rackPos{10},];

    CONST robtarget rackPos{1}:=[]; !rackPos01 through rackPos10 are the locations of each weight on the weight rack.

    CONST robtarget rackPos{2}:=[];

    CONST robtarget rackPos{3}:=[];

    CONST robtarget rackPos{4}:=[];

    CONST robtarget rackPos{5}:=[];

    CONST robtarget rackPos{6}:=[];

    CONST robtarget rackPos{7}:=[];

    CONST robtarget rackPos{8}:=[];

    CONST robtarget rackPos{9}:=[];

    CONST robtarget rackPos{10}:=[]; 

    Would it be simply CONST array rackPos{i}:= [rackPos{1}, rackPos{2}.......];  ?

    The 10 rack positions will be known and calibrated once I have the rack.
    Spencer RD2013-03-14 17:27:36