Loop through Z heigths

  • Hi,


    To reduce the program size, I want to use a While loop to Loop through my program and change the Z value every time.

    The following code (only relevant lines) is wrong, I cant use the variable Zax in my positions, how to fix this?

    ____________________________


    DEF JIHAAA3()


    DECL INT Zax


    Zax=2


    LIN {X 400.000,Y 850.000,Z 207.000,A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


    LIN {X 500.000,Y 850.000,Z 8.000,A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


    $VEL.CP=0.0099


    WHILE Zax < 200



       LIN {X 500.000,Y 850.000,Z Zax, A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


       LIN {X 499.881,Y 845.131,Z Zax ,A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


       LIN {X 499.526,Y 840.274,Z Zax ,A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


       LIN {X 498.934,Y 835.440,Z Zax ,A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


       LIN {X 498.108,Y 830.640,Z Zax, A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


       LIN {X 497.049,Y 825.887,Z Zax, A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


       LIN {X 495.760,Y 821.190,Z Zax, A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS


       LIN {X 494.244,Y 816.562,Z Zax, A -90.001,B 0.000,C 0.000,S 6,T 27,E1 0.000,E2 0.000,E3 0.000,E4 0.000,E5 0.000,E6 0.000} C_DIS

    ENDWHILE
    END


    Thanks!

  • Place your Ad here!
  • kwakisaki

    Approved the thread.
  • I'm a bit rusty on Kuka... but maybe if you declare that 8 points globally, you can then edit the Z coordinate of all points before performing the movement.

    Not inside the point itself, but overwritting the Z value of every position before executing the movement.


    Putting a variable inside the declaration of the local point will likelly result on a syntax error, also you are not incrementing zAx so that loop will run forever.

    You should be able to access data on the point by putting $xPointName1.x or something similar, like when you access the variables through the smartpad.

  • you need to lookup differences between variable, constant and literal.

    inside aggregate only literals are acceptable.


    also you have other issues there:

    there is no motion parameter initialization.

    there is no initial PTP motion for BCO

    your Z value in the loop is not changed at all - even if the variable was accepted, point value would not change etc.


    this is one way to cure some of those problems. this is tailored to match your attempt.

    the other way is to leave points as they are and manipulate base.

    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

  • I would recommend creating a Base that has its Z axis aligned the way you wish to offset your paths, and use that:

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

Advertising from our partners