Shifting based on TCP COORD's

  • Hello,

    I am trying to get the attached program to work properly. It works ok besides the fact that all of my calculations are done in base coords. Is there a way to get this to work with TDRAW or otherwise to make the shifts and calculations based on the TCP? I run the GET HEAD WEAR below and then run the PROCESS PART pg.

    Code
    PROCESS PART
    ;  POINT posofst1 = hdawear+part1og1  LMOVE posofst1
    ;  POINT posofst1 = hdawear+part1og2  LMOVE posofst1;
    ;  POINT posofst1 = hdawear+part1og3  LMOVE posofst1
    ;  POINT posofst1 = hdawear+part1og4  LMOVE posofst1
    ;  POINT posofst1 = hdawear+part1og5  LMOVE posofst1
    ;  POINT posofst1 = hdawear+part1og6  LMOVE posofst1
    ;  POINT posofst1 = hdawear+part1og7  LMOVE posofst1;


  • ANY taught transformation that is saved as a variable is the TCP translation (XYZ) and orientation (OAT) of the current TCP referenced to the BASE.


    Therefore using the TRANS command in conjunction with a saved transformation variable will 'shift' it with reference to the saved transformation variable values.


    In your example above, it is doing just this but creating a new variable called 'searching', using the variable 'taughtpos1' and adding/shifting 70mm to the Z

    Code
    POINT searching = taughtpos1+TRANS(0,0,70,0,0,0)

    So if you are constantly changing the XYZOAT values of an existing transformation variable then simply:


    Code
    POINT taughtpos1 = taughtpos1+TRANS(0,0,70,0,0,0)

    Within the TRANS parenthesis, you can then use real variables/calculations to define any of the internal elements (X,Y,Z,O,A,T).


    Alternatively you can just use raw transformation data without the use of transformation variable.

    This method carries a risk and would usually require further calculations in order to correctly define the XYZOAT values.

    Code
    LMOVE TRANS(X,Y,Z,O,A,T)
  • So this is fine until I get my "foundpos" and try to apply it to the "taughtpos1".

    I really only want to know the difference in Tool direction Z and apply this to all existing variables.

    It seems every time I run it, it still wants to reference TCP to the base for this calculation.

    Maybe I am miss understanding or didn't explain that right?


    So I move into part lets say 15 mm of the 70 I shifted above in tool.

    I then want to take that 15 mm in tool Z that I got from my XMOVE and apply to my posoffset1.

    The difference of foundpos and taughtpos1 in Z tool direction needs to be saved in hdawear and applied to part1og1 as an 'offset'.

    Edited once, last by Jestepp ().

  • I really only want to know the difference in Tool direction Z and apply this to all existing variables.

    It seems every time I run it, it still wants to reference TCP to the base for this calculation.

    Maybe I am miss understanding or didn't explain that right?

    Yep, nothing like that exists in your post.


    DECOMPOSE your taught position to store all your elements to a variable array.

    Then use the Z element to determine the difference between reference and taught.


    Alternatively Use DZ to grab the z element from your taught position and compare with the DZ element of your reference position to determine the difference between both.


    In each case, store the determined difference as a real variable, then you can stick that in any variable using POINT, TRANS..........

  • So DECOMPOSE is just setting XYZOAT to 6 array elements in which are all still relative to base.

    When grabbing the Z element I am getting the same result as below just broken out in to seperate elements:

    POINT/Z hdawear = foundpos-taughtpos1 ; SETS ONLY Z VALUE TO HDAWEAR


    Which isn't right I shifted 70mm in TOOL Z using TRANS and somehow the Z element is telling me I only move ~3mm which is just confusing the heck out of me.

  • DECOMPOSE creates a variable array containing the elements of the location variable.

    The location variable values are relative to whatever they were taught reference too....not necessarily the base, this is purely code dependent.


    Where are your values for:

    - taughtpos1

    - searching

    - foundpos

  • Where are your values for:

    - taughtpos1 - Drove robot to position created a block step ran HERE command

    - searching - Defined in the first post LINE 6

    - foundpos - Defined in first post LINE 9


    See the attached pic in the previous post with their values. using list/L

  • I don't know what is confusing for you.


    You create 'taughtpos1' location.

    Then you create 'searching' using 'taughtpos1' with a 70mm (offset) creating a location 70mm further towards the target.

    Your XMOVE will move to the 'searching' location (further in) till the signal is triggered.

    You the save that triggered position to 'foundpos'.


    As you are moving linearly with no orientation change from 'taughtpos1' to 'searching', then the distance (Z) between 'foundpos' and 'taughtpos' will be the Z distance the TCP travelled from 'taughtpos1' and 'foundpos'.


    The values appear correct to me..................you sure your TCP is set correctly and the signal is being set correctly for your position?

  • TCP works well yes it is good.

    POINT searching = taughtpos1+TRANS(0,0,70,0,0,0)

    Works well moves along z axis in tool 70mm yet the data says 3 in hdawear variable.

    I clearly see the robot in KRoset move the full 70mm.

    So when i try to use the hdawear variable to create what should have been a 70mm z offset i am getting 3.

  • Still not 100% understanding what your goal is.


    All positions are relative to how they are taught, so no idea what tool settings base settings or frame settings you are using, you don't mention them.


    According to the location values:

    POINT hdawear = foundpos - taughtpos1 returns -3, which is correct.

    This is the Z value difference between the two.


    Remember you are moving from 'taughtpos1' to 'searching' using the current base or frame values.

    So those variables are relative to the base not the tool.

    The location data saved is the difference between TCP and base, frame values.


    You may need to be looking at the inverse of your compound calculation:

    POINT hdawear = - taughtpos1+foundpos

  • I guess I don't understand why writing it backward from what I had comes out with that 70mm in z when the data is the same. That makes 0 sense to me.

  • I guess I don't understand why writing it backward from what I had comes out with that 70mm in z when the data is the same. That makes 0 sense to me.

    Then read the AS manual, look for Transformation Value Operators.


    Do you know exactly what your end goal is?

    Are you trying to overcomplicate something simple?

    Instead of talking 'code', why not explain in basic terms what you are trying to achieve?

  • Then read the AS manual, look for Transformation Value Operators.


    Do you know exactly what your end goal is?

    Are you trying to overcomplicate something simple?

    Instead of talking 'code', why not explain in basic terms what you are trying to achieve?

    Instead of talking 'code', why not explain in basic terms what you are trying to achieve?

    So it's a polish wheel.

    I am using that XMOVE to wait for a VFD feedback signal from PLC to stop me and save this to foundpos then compare 'foundpos' to 'taughtpos1' to determine the amount of offset in Tool Z Direction for the wore down wheel.

    Then adjust all my original points using HDAWEAR and their original position data.


    Are you trying to overcomplicate something simple?

    I didn't have a full understanding of Transformation Value Operators and the fact that it isn't just math so potentially i was/am.

  • So what Arm model are you using - ZX/BX ?

    So what are your tool (TCP) values?

    I didn't have a full understanding of Transformation Value Operators and the fact that it isn't just math

    Yes, I hear you there, not a very easy concept to digest and as you can see it's not just straight forward commutative law with the values and can be very frustrating........... :wallbash:


    The way I understood it was by reading the Transformational Value Operators and in simple terms, draw the XY grid as in the manual and plot your represented points in there and look at the examples.

    This may help............


    When you write:

    compare 'foundpos' to 'taughtpos1'

    Let me word it a little different.


    The 2 positions have stored values which represent the TCP location (XYZ) and orientation (OAT) relative to a coordinate system (BASE/FRAME).


    You are looking at the distance (XYZ) and orientation (OAT) between 2 positions, not BASE or anything else, so you are looking at comparing the 2 values, so you need to factor in one of these locations needs to be treated as your reference.


    One location is your reference 'taughtpos1' and the other location is the current location 'foundpos'.

    So you are looking at finding the offset (difference) which when added to 'taughtpos1' will be the same as 'foundpos'.

    Code
    POINT taughtpos1+hdawear = HERE

    The above instruction uses HERE ('foundpos' values) and will inversely calculate how far it is away from 'taughtpos1' and define 'hdawear' with those values.


    That difference when then added to the 'taughtpos1' location should be the same as the current position to a limited accuracy and decimal place.

  • Just wanted to say thanks for the help. Everything is working great now and i was able tp simplify alot of my code! I have a good grasp on Transformation Value Operators. So again thanks! Maybe next time i wont over complicate things 🤣

  • Sorry,

    I wasn't implying that you were overcomplicating things, merely trying to make a hint for you to look more at your end goal and how compound transformations and the operators can be used for your purpose as it is a minefield when first exposed to it.


    Kawasaki AS language is known for some complexities, however the language is extremely powerful and flexible and sometimes a few minutes fumbling around the manual and trying out some of the examples yields some positive results.


    Glad you've got it working in the end, learning and obtaining the results you require is the goal.

    How your code structure was laid out, was sound, easy to follow and well commented.

    Well done for your perseverance............... :top:

Advertising from our partners