RobotStudio event

Offset position array

Options
Hi :)

I am a student working with Robotstudio, and my current project involves stacking 2 different items each in 3 stacks of 3items, with only using 1 offset. I also have to be able to swap between those 2 items, and the robot needs to remember where in the stacking process it was.
I was thinking about using some array funktion to remember the positions.
If you have any tips on how to make the array function or another more simple way to solve this task, i would love to hear from you :)

In the example below from my code it just runs the For loop stacking all the 9 item, if you stop halfway it starts over.

Var robtarget PosChromeVar;

IF DI10_1 = 1 THEN
            FOR z FROM 0 TO 2 DO
                FOR x FROM 0 TO 2 DO
                PosChromeVar := Offs(PosChrome,-x *50, 0,z *30);
                chrome;
                ENDFOR
            ENDFOR
           
            ELSEIF DI10_2 = 1 THEN
            FOR z FROM 0 TO 2 DO
                FOR x FROM 0 TO 2 DO
                PosBlackVar := Offs(PosChrome,-x *50, 50,z *30);
                black;
                ENDFOR
            ENDFOR   
            ENDIF

    PROC chrome()
        IF DI10_1 = 1 AND ChromeCount < 9 THEN
        MoveJ Pos10, v1000, z50, AT2_Vacuum_Tool;
        MoveL p20, v1000, z1, AT2_Vacuum_Tool;
        SetDO\Sync, DO10_1, 1; 
        MoveL Pos10, v1000, z50, AT2_Vacuum_Tool;
        MoveJ PosChromeVar, v200, z1, AT2_Vacuum_Tool;
        Reset DO10_1;
        MoveJ StartPos, v1000, z50, AT2_Vacuum_Tool;
        Incr ChromeCount;
        ENDIF
    ENDPROC


Daniel 


Comments

  • jmf
    Options
    Try changing VAR to PERS.
  • lemster68
    lemster68 ✭✭✭
    Options
  • Djustesen
    Options
    Thanks alot to both of you :) I really appreciate your help.. 
    That program looks really usefull, i guess i can get some inspiration from that :)

  • Djustesen
    Options
    I will thanks, Jmf :) 
    I guess right now the FOR loop is my problem.. that it wont remember the position it leaves, when changing to the other item and back again(right now it start over from pos 1.)
    A solution could be IF ChromeCount = 4 Then … and then define x and z.  
    And again when ChromeCount = 7 or something like this. or find a way to make an array that defines x and z according to the counted value if thats posible :smile:
  • lemster68
    lemster68 ✭✭✭
    Options
    The problem is that every time you initialize the FOR you are using a fixed value, 0.  You can use a group input(if you have one), a group output (you can set up a dummy, simulated) or just use a PERS num variable like FOR z FROM nZCounter TO 2 DO
                                                                FOR x FROM nXCounter TO 2 DO
    Lee Justice