Base transformation

  • Hey everyone,

    I'm new to KRL and I need some help into my palletizing project.


    Basically I want to move the same point on a FRAME and changed the frame. X every time my program is looped.


    exemple:


    DECL Point 1 ={X 2123.80151,Y -11.0088034,Z 1258.20068,A 175.519653,B 89.8564301,C 23.5823574,S 2,T 35,E1 0.0,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0}

    FRAME_DATA[1]={X -1329.70984,Y 1787.50391,Z 143.175064,A 0.0,B 0.0,C 0.0}


    every time program is loop add 400 to X coord of base :


    FRAME_DATA[1]={X -1329.70984 +(400 * nb looped) ,Y 1787.50391,Z 143.175064,A 0.0,B 0.0,C 0.0}


    I thought I can use a variable inside the frame coordinate but that does not work.


    any help on frame transformation would be appreciate


    thanks in advance

  • Place your Ad here!
  • If I understood what is it you are asking, then vast majority of my helping effort went into just deciphering what you are asking for. I gather that English is not your first language, but you can still make it easier to help you. In this case, there was no need for the decimal points and you could have provided input and results of at least a couple loop cycles, like:


    FRAME_DATA[1]={X -1300 ,Y 1787,Z 143,A 0.0,B 0.0,C 0.0}


    After first cycle: {X -1700 ,Y 1787,Z 143,A 0.0,B 0.0,C 0.0}


    After second cycle: {X -2100 ,Y 1787,Z 143,A 0.0,B 0.0,C 0.0}


    As to how to do it- separately, e.g.


    FRAME_DATA[1]={X -1300 ,Y 1787,Z 143,A 0.0,B 0.0,C 0.0}

    FRAME_DATA[1].X= -1300+400*nbLooped

  • Hey Mentat,


    You guess it right,

    I could have more clear about my previous post.

    I thought the formula needs to be inside the coordinate of the frame data

    FRAME_DATA[1]={X -1300+400*nbLooped ,Y 1787,Z 143,A 0.0,B 0.0,C 0.0}

    That's why I got an error when compiling.

    Is it possible to read X value of the point? The value might change over time. I do not see any instruction inside manuals in order to read cartesian value of point.


    thanks

  • Hey Mentat,

    Is it possible to read X value of the point? The value might change over time. I do not see any instruction inside manuals in order to read cartesian value of point.


    thanks

    What point? The one where robot TCP is currently at in current base? That's read only system variable $pos_act. If you are thinking about some other point, then describe it and/or the scenario in more detail.

  • Try this


    FRAME_DATA[1]=FRAME_DATA[1].X+400*nbLooped

    yes mental already give me the solution, but thank for your answer.

    What point? The one where robot TCP is currently at in current base? That's read only system variable $pos_act. If you are thinking about some other point, then describe it and/or the scenario in more detail.

    Indeed the point where TCP is in the current base . I want to extract X,Y,Z coordinate and store it into REAL variable

  • Try this


    FRAME_DATA[1].X=FRAME_DATA[1].X+400*nbLooped

    Correction in red.


    Robot's current position (active TCP in active Base) can be obtained from $POS_ACT (older systems) or $POS_ACT_MES (newer systems). Newer robots also have $POS_ACT available, but of the two $POS_ACT_MES is the more accurate choice.


    Using either one "on the fly" can be a bit risky, though -- it takes extra work to ensure that you are "capturing" $POS_ACT at a particular time. If the robot is not moving, and a WAIT SEC 0 or something similar is used to break the Advance Run Pointer, that's the best condition to capture $POS_ACT.

  • Using either one "on the fly" can be a bit risky, though -- it takes extra work to ensure that you are "capturing" $POS_ACT at a particular time. If the robot is not moving, and a WAIT SEC 0 or something similar is used to break the Advance Run Pointer, that's the best condition to capture $POS_ACT.


    AFAIK, $pos_act and $pos_act_mes are based on the robot state and trigger an advance run stop by themselves. Just like $in, $out and the like. Is this something that has changed in the newest versions?

  • Is it possible to read X value of the point? The value might change over time. I do not see any instruction inside manuals in order to read cartesian value of point.

    The manual is f.e. "KUKA System Software 8.3 Operating and Programming Instructions for System Integrators" in chapter "11.4.3 STRUC".

    Frames, e6axis, e6pos .... are all structures.


    Most things are documented, but most time it's not easy to find. :winking_face:

  • manuals do have info. and if following manual is not easy, that is not unexpected. that is the reason that training exists, like KUKA classes :winking_face:


    but if you really want to learn programming, you need to take other courses that cover general computing concepts before diving into something specific like KRL, or you are bound to be confused about core principles. KUKA classes are focused on specific end goal (robotic application), not teaching generic computing fundamentals.


    so i think this is result of not understanding basics of computing... and in this particular case, problem is not understanding the difference between literal, constant and variable. and it is true, KUKA documentation does not really bother to make that distinction...


    VARIABLE is a memory location, containing value that is accessible by name (variable name). it is called "variable" because value can be changed.


    CONSTANT is a memory location, containing constant value that is accessible by name (constant name). it is called "constant" because value cannot be changed.


    LITERAL is a (hardcoded) value. such as 3.14 or "Hello" or FALSE. it does not have name, only value. note that while behavior may be similar, this is NOT the same thing as a constant.


    Now that we have some reasonably proper (and still generic) definitions, it should not be hard to explain certain KRL peculiarities:


    KRL permits only literals (and not constants) in certain places, such as array declarations, structure aggregates etc.


    curly braces are used to define structure aggregates. you can only use literals in there, not variables, not constants, not expressions...


    example of declarations (in DAT file)

    DECL INT NumX ; declare variable, no initial value

    DECL INT NumY = 10 ; declare variable with initial value

    DECL CONST INT NumZ = 20 ; declare constant - MUST have value (constant cannot be modified so value CANNOT be assigned later)

    DECL FRAME f = {x 0, y 100, z 50} ; declare variable, type is structure, partially initialized (a,b,c not initialized)


    example of program code (in SRC file)

    NumX = 5 ; assign literal

    NumX = NumY ; assign variable

    NumX = NumZ ; assign constant

    f.B = 45 ; assign new value to element B of variable f. only element B is affected.

    f={x 0} ; assign new value as structure aggregate. value is assigned to f... so ENTIRE variable f is affected (all of it's elements!!!)

    f={x NumX*0.75} ; expression not allowed, must be a literal

    f={z NumZ} ; constant not allowed, must be a literal

    f.X = NumX*0.75 ; allowed

    f.Z = NumZ ; allowed

    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

  • Thank you everyone for your quick response and reactivity.


    As I said before the formula where you specify the right coordinate (X,Y or Z) : MYFRAME[1]=FRAME_DATA[1].X+400*nbLooped works as expected.


    I did change things a bit : they were no use of changing Frame value but instead I'm using a ReferencePoint basically located at coordinate (X0.Y0,Z0) of my palette and I change other points based of this referencePoint.


    XPoint1.X = XReferencePoint.X + ( DEC_X * INT_nb_looped )


    XPoint1.Y = XReferencePoint.Y + ( DEC_Y * INT_nb_looped )


    XPoint1.Z = XReferencePoint.Z + ( DEC_Z * INT_nb_looped )


    When I_nb_looped get higher and higher value, Xpoint 1 is moving through X axis accordingly. DEC_Y and Z is set to 0.


    Surprisingly after INT_nb_looped reached a certain point, I got an error value 1447.


    I try to find the solution in the forum , the robot cannot reach point cause Software limit is out of range.

    So I need to create intermediaire point or change the destination point, but when I use the JOG motion the robot is very capable of moving to the next point and my axis values are far away from limit.


    any ideas?


    I hope this in understandable :smiling_face: Thank


  • well, you are not posting your code... but my spidey senses are telling me that


    you are asking robot to use Status and Turn values... even when they are no longer valid.

    in this case it is a turn value for that specific axis need to be changed

    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


  • Read through expert programing manual, familiarize yourself with geometric operator (it's just 4x4 matrix multiplication if you are already familiar with those), status and turn. Your code will be less messy and easier to read/modify.

    I abhor needless effort and first reading documentation for any complex system is usually a path of least work.

  • Hi,


    status and turn are only used for ptp movements.

    For lin movements they are not used.


    What you could do is calculating the inverse of your position and check the return code.

    for the inverse function you also could set

    $TARGET_STATUS

    to

    source:

    take the status from start point

    best:

    shortest distance


    Another way would be

    check the limits and write you a small python script in order to check the axes positions


    regards


    MOM

  • and yet another way is to simply do as asked and post the actual code, so those trying to help are font forced to guessing and exploring every conceivable possibility

    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

  • well, you are not posting your code... but my spidey senses are telling me that


    you are asking robot to use Status and Turn values... even when they are no longer valid.

    in this case it is a turn value for that specific axis need to be changed

    What code do you need? there is nothing more than the code I posted earlier except real coordinate of point 1 . Not sure this gonna help :frowning_face:


    ;FOLD PTP Pinter1 CONT Vel=50 % PDAT2 Tool[3]:STYLO Base[0];%{PE}

    ;ENDFOLD

    $BWDSTART = FALSE

    PDAT_ACT = PPDAT2

    FDAT_ACT = FPinter1

    BAS(#PTP_PARAMS, 50.0)

    SET_CD_PARAMS (0)

    PTP XPinter1 C_Dis

    ;ENDFOLD


    ;DEC_X=300 DEC_Y=400 DEC_Z=400

    XApproPosePal1.X = XPoriginePal1.X+(DEC_X*XPAL_1)

    XApproPosePal1.Y = XPoriginePal1.Y+(DEC_Y*YPAL_1)

    XApproPosePal1.Z = XPoriginePal1.Z+(DEC_Z*ZPAL_1)


    ;FOLD LIN ApproPosePal1 Vel=1 m/s CPDAT5 Tool[3]:STYLO Base[1]:Palette ;%{PE}

    $BWDSTART = FALSE

    LDAT_ACT = LCPDAT5

    FDAT_ACT = FApproPosePal1

    BAS(#CP_PARAMS, 1.0)

    SET_CD_PARAMS (0)

    LIN XApproPosePal1

    ;ENDFOLD



    Read through expert programing manual, familiarize yourself with geometric operator (it's just 4x4 matrix multiplication if you are already familiar with those), status and turn. Your code will be less messy and easier to read/modify.

    I abhor needless effort and first reading documentation for any complex system is usually a path of least work.

    You are correct sir. It's tough to find the correct manual though. I feel like sinking into an ocean of information


    That works indeed, I need to find the solution with PTP mouvement though , just in case it might happen again :).

    Great I did some python during lockdown to break boredom. Might be useful

  • Quote

    What code do you need? there is nothing more than the code I posted earlier except real coordinate of point 1 . Not sure this gonna help :frowning_face:

    ....

    That works indeed, I need to find the solution with PTP mouvement though , just in case it might happen again :).


    So you just changed motion from PTP to LIN.... so code you posted is still not the code you had there when you got the error message. And you wonder why it is hard to help you? Here is an idea - when you get the problem and error message, and want help with it.... post THAT code.


    As suggested, this is related to Status and Turn (more specifically to Turn). CP motions do use Status and Turn but... they ignore programmed values of S &T, instead - they calculate their own. PTP motion does not do that so when you get to axis reversal for example, PTP motion would try to go all around to reach commanded position (instead of just few degrees using shortest path).

    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

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