Advertising

KUKA loop and move in Z

  • Afternoon,
    I am operating a KR16 robot with KRC2 control.
    I have written a program to deposit a 150mm long weld on a plate, however i would like to loop this program and add 1mm to Z after every pass, to build a wall.
    Any help appreciated.
    Cheers,
    Joe.


  • Hi,


    could you paste program code here?


    DEF line_150_1()
    ;FOLD INI
    ;FOLD BASISTECH INI
    GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
    INTERRUPT ON 3
    DEF_CIRC_TYP=#PATH
    BAS (#INITMOV,0 )
    ;ENDFOLD (BASISTECH INI)
    ;FOLD ARCTECH_ANALOG INI
    IF A10_OPTION==#ACTIVE THEN
    INTERRUPT DECL A_Arc_Control_Intr WHEN $CYCFLAG[A_CycFlagIndex1]==FALSE DO A10 (#APPL_ERROR)
    INTERRUPT DECL A_Arc_Swi_Intr WHEN A_ARC_SWI==#ACTIVE DO A10 (#ARC_SEAM)
    INTERRUPT DECL A_Arc_HPU_Intr WHEN A_FLY_ARC==TRUE DO A10 (#HPU_ARC)
    INTERRUPT ON A_Arc_HPU_Intr
    A10_INI ( )
    ENDIF
    ;ENDFOLD (ARCTECH_ANALOG INI)
    ;FOLD USER INI
    ;Make your modifications here
    ;** SETS THE SPEED TO THE CORRECT 50% VALUE **
    IF $OV_PRO>=50 THEN
    $OV_PRO=50
    ENDIF
    A10_WRITE_ENABLE=TRUE
    WRITE_CUR=FALSE
    WRITE_WFD=FALSE
    INTERRUPT DECL 18 WHEN WRITE_CUR DO TIG_VAR ( )
    INTERRUPT DECL 19 WHEN WRITE_WFD DO TIG_VAR ( )
    INTERRUPT ON 19
    INTERRUPT ON 18
    ;ENDFOLD (USER INI)
    ;ENDFOLD (INI)


    ;** THIS IS THE VEL STEP SET BETWEEN 1 - 50 **
    ;VEL_STEP_OFFSET=3



    BASE_DATA[17].X=0.0
    BASE_DATA[17].Y=0.0
    BASE_DATA[17].Z=0.0


    ;*** Set the tool and TCP offsets
    ; TOOL 16, TCP offsets: -0.5, 0.503, 411.890015
    TOOL_DATA[16]={x -0.5, y 0.503, z 411.89001, a 180.0, b 0.0, c 0.0 }


    LOOP


    ;***above start POSITION 1 -----TO CHANGE TO P2------ ***
    ;FOLD PTP P29 CONT Vel= 5 % PDAT3 Tool[16]:OFFLINE TIGTORCH Base[17]:DKP_400;%{PE}%R 5.2.271,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P29, 3:C_PTP, 5:5, 7:PDAT3
    $BWDSTART = FALSE
    PDAT_ACT=PPDAT3
    FDAT_ACT=FP29
    BAS(#PTP_PARAMS,5)
    PTP XP29 C_PTP
    ;ENDFOLD


    ;*** weld start POSITION 2 ***
    ;FOLD LIN P1 Vel= 0.005 m/s CPDAT1 ARC_ON PS S Seam1 Tool[16]:OFFLINE TIGTORCH Base[17]:DKP_400;%{PE}%R 1.1.4,%MKUKATPARC,%CARC_ON,%VLIN,%P 1:LIN, 2:P1, 3:, 5:0.005, 7:CPDAT1, 9:1, 10:S, 12:Seam1
    $BWDSTART=FALSE
    LDAT_ACT=LCPDAT1
    FDAT_ACT=FP1
    BAS(#CP_PARAMS,0.005)
    A10(#PRE_ARC_ON,A10BS,A_W_PARA_ACT,A_E_PARA_ACT,1)
    LIN XP1
    A10(#ARC_STRT)
    ;ENDFOLD


    ;*** weld start POSITION 2 ***
    ;FOLD LIN P2 CPDAT3 ARC PS 1 W2 Tool[16]:OFFLINE TIGTORCH Base[17]:DKP_400;%{PE}%R 1.1.4,%MKUKATPARC,%CARC_SWI,%VLIN,%P 1:LIN, 2:P2, 3:, 5:0.005, 7:CPDAT3, 9:1, 11:W2
    $BWDSTART=FALSE
    LDAT_ACT=LCPDAT3
    FDAT_ACT=FP2
    BAS(#CP_PARAMS,LDEFAULT.VEL)
    A10(#PRE_ARC_SWI,A_S_PARA_ACT,A10WW2,A_E_PARA_ACT,1)
    LIN XP2
    ;ENDFOLD


    ;*** end point POSITION 3 ***
    ;FOLD LIN P27 CPDAT4 ARC PS 1 W3 Tool[16]:OFFLINE TIGTORCH Base[17]:DKP_400;%{PE}%R 1.1.4,%MKUKATPARC,%CARC_SWI,%VLIN,%P 1:LIN, 2:P27, 3:, 5:0.005, 7:CPDAT4, 9:1, 11:W3
    $BWDSTART=FALSE
    LDAT_ACT=LCPDAT4
    FDAT_ACT=FP27
    BAS(#CP_PARAMS,LDEFAULT.VEL)
    A10(#PRE_ARC_SWI,A_S_PARA_ACT,A10WW3,A_E_PARA_ACT,1)
    LIN XP27
    ;ENDFOLD


    ;*** wire retract NO POSISTION ***
    ;FOLD SYN OUT 200 '' State= FALSE at END Delay= 0 ms;%{PE}%R 4.1.15,%MKUKATPBASIS,%COUT,%VSYNOUT,%P 2:200, 3:'', 5:FALSE, 7:1, 9:0, 12:0
    TRIGGER WHEN DISTANCE=1 DELAY=0 DO $OUT[200]=FALSE
    ;ENDFOLD
    ;FOLD PULSE 31 'O31_FRONIUS_RET' State= TRUE CONT Time= 0.1 sec;%{PE}%R 4.1.15,%MKUKATPBASIS,%COUT,%VPULSE,%P 2:31, 3:'O31_FRONIUS_RET', 5:TRUE, 6:CONTINUE, 8:0.1
    CONTINUE
    PULSE($OUT[31], TRUE,0.1)
    ;ENDFOLD


    ;*** end point POSITION 3 ***
    ;FOLD LIN P24 CPDAT25 ARC_OFF PS E Seam1 Seam0 Tool[16]:OFFLINE TIGTORCH Base[17]:DKP_400;%{PE}%R 1.1.4,%MKUKATPARC,%CARC_OFF,%VLIN,%P 1:LIN, 2:P24, 3:, 5:0.005, 7:CPDAT25, 9:1, 10:E, 11:Seam1, 12:Seam0
    $BWDSTART=FALSE
    LDAT_ACT=LCPDAT25
    FDAT_ACT=FP24
    BAS(#CP_PARAMS,LDEFAULT.VEL)
    A10(#PRE_ARC_OFF,A_S_PARA_ACT,A10WE,A10ESeam1,1)
    LIN XP24
    A10(#ARC_OFF)
    ;ENDFOLD


    ;*** above end point POSITION 4 ***
    ;FOLD LIN P26 CONT Vel= 0.005 m/s CPDAT26 Tool[16]:Tig Torch BASE_DATA[17];%{PE}%R 4.1.14,%MKUKATPBASIS,%CMOVE,%VLIN,%P 1:LIN, 2:P26, 3:C_DIS, 5:0.005, 7:CPDAT26
    $BWDSTART = FALSE
    LDAT_ACT=LCPDAT26
    BAS(#CP_DAT)
    FDAT_ACT=FP26
    BAS(#FRAMES)
    BAS(#VEL_CP,0.005)
    LIN XP26 C_DIS
    ;ENDFOLD


    ENDLOOP


    END

  • Hi,
    You can solve it by adding an "BASE_DATA[17].Z=BASE_DATA[17].Z + 1" Before ENDLOOP. Off course if direction of build is parallel to Base Z+ direction.

  • After each execution the program, you can move the base of 1mm in Z direction.


    For example:
    BASE_DATA[17].Z= BASE_DATA[17].Z + 1


    Second way is changing point value of z coordinate.

    Edited once, last by 1s1g+ ().

  • That being said, remember you'll need a way to revert Base 17 back to its original value before starting the next loop. So you'll probably want to make another variable, perhaps a CONST, or perhaps another Base that's not used, assign that the permanent un-shifted value of Base 17, and always set Base 17 back to that value at the beginning of the program, before the start of the loop.

  • BASE_DATA[17].Z= BASE_DATA[17].Z + 1 works only if the euler angles are zero, so I would recommend to use the geometric operator.


    BASE_DATA[17] = BASE_DATA[17]:{X 0, Y 0, Z 1, A 0, B 0, C 0}

  • Well, for sake of being pedantic, :icon_rolleyes: the Z+1 method will work as long as the Z axis of Base 17 is parallel to the Z axis of $WORLD. But Spl is right, the geometric operator is the better option.

  • how about entire message? what line of code?


    "constant expected" means you are not using constant where constant is expected. for example you are trying to use variable instead of constant.


    for example, if you are using aggregate, you MUST use constants:

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Hi everybody


    Well my problem is similar, but i would like to do a loop with the TCP, add or substract the distance mesure for a sensor.


    Anyone knows, how i can do this?


    Thanks
    Itzel

  • TOOL_DATA can be manipulated exactly the same as BASE_DATA. Both are FRAME type variables, both interact with the Geometric Operator in the same way.


    One caveat: when using the Geometric Operator, all six values MUST be filled in, even if you only use a 0.


    BASE_DATA[17] = BASE_DATA[17] : {Z 10} ; invalid
    BASE_DATA[17] = BASE_DATA[17] : {X 0,Y 0,Z 10,A 0,B 0,C 0} ; valid

  • I forgot to explain that I use to RSI for get the information of force sensor. My force sensor mesure the distance in Z, this distance is send by RSI and i would like to the distance modified the TCP (my TCP initial is 230 mm in Z. If the distance mesure by sensor is the 2 mm, the distance in Z for the TCP change to 228 mm).


    I read the forum is possible to modify the base_data[], but I didn't understand if it is possible with the RSI the datasheet is not too clear.


    Thanks

  • Okay, that's a completely different thing.


    You can't change $TOOL or $BASE dynamically on the fly between motions -- changes to $BASE or $TOOL only take effect at the start of a motion command. As such, making changes to $BASE or $TOOL in KRL cannot effect "realtime" changes to motion, only on a motion-by-motion basis.


    RSI cannot change Base or Tool. RSI only controls motion. It can alter motion along either the Base or Tool axes. However, RSI can carry out "realtime" motion adjustments, unlike KRL (which is why RSI exists).

  • Hello ,


    First post here, I hope I don't mess it up.


    Been in the shadows reading lots of posts and checking for info.

    I found this post interesting because I'm trying to kind of do the same but It seems like some setting is not right for me.


    We have a Kuka KR 150 L120/2 E with a KR C2 control 5.2.14 soft version + linear rail + 2 turntables all KUKA branded.


    At the moment the goal is to weld several seams in a cylinder which is attached to one turntable while it is constantly turning and the TCP stands still in the same point, after a 360º turn it is supposed to shift itself "x" mm to keep doing the next seam and so on for the amount of seams needed.


    For this the turntable has been mastered so that it can be coupled and synchronized, also it has been set to endless type of movement (Axis_type=5 as I recall), also I am taking into account that even in the endless type of movement the turntable will rotate in the direction of the shortest path.


    For programming the circle I am using the turntable as base and I calculate the points so the TCP doesn't move while the base rotates (X, Y and C change as E3 Changes). This I got right, I can make one seam without any problem and the turntable will rotate and the TCP will stand still. Even if I loop this (with for loop for example) I can repeat the circle and check that the turntable set to endless keeps rotating always in the same direction.


    My problem comes when I try to shift the seam ( In the base of the turntable it is Z direction but in the world base it is X direction) . To achieve this I have tried what was suggested earlier in this post :


    OFS={X 0, Y 0, Z 0, A 0, B 0, C 0}

    OFS.Z=Layer_height

    BASE_DATA[17] = BASE_DATA[17]:OFS


    When I do this, the tool starts moving though it should not. I have tried changing both X or Z and in both cases I got the same result.


    I am attaching my code here in case you can check it ( by the way, I am using .dat+.src so I declare variables in .dat)

    Files

    • cont2.txt

      (3.12 kB, downloaded 8 times, last: )
  • offsetting base using frame and geometric operator works and it is used all the time.

    incrementing point Z value works and it is also used all the time. but you need to make sure to not mix apples and oranges. you are adding:

    XP1 is E6POS

    XP1.Z is REAL

    5 in an INT


    you can add and assign values of REAL and INT to each other.

    you can do the same with individual elements of E6POS but you cannot use entire E6POS structure as a single REAL or INT.


    another thing to watch for is how exactly points and bases are restored. your code is screaming bad practice or collision waiting to happen:

    1. you copy base 18 to base 4

    2. you manipulate base 18

    3. then restore base 18 from base 4


    if user resets or aborts half-executed program , last part will not happen and that means base 4 value is not use to restore base 18. next time program is started, base 4 itself will get WRONG value from base 18 and now you also have no good backup of that base any more.


    same applies to point manipulation. FYI, i would NEVER let program manipulate reference data (base or point). those can and should only be handled manually (touchup or commissioning). but i would COPY reference data to another variable and THEN manipulate and use that copy.

    then it does not matter what user does, when you start program you always starts with GOOD reference value.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Hello Panic Mode, Thank you very much for your reply.


    I will modify it so I don't mix apples and oranges.


    I was aware already about the base 18 restoring thing. I was doing it this way because when I get into the .dat I don't really know how to modify the base of the points, like in FDAT of each point I have BASE_DATA 18. How to change it to a base that I declare earlier? like BASE_DATA MYBASE (in case I declare DECL FRAME MYBASE)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now