Mapping I/O KRC4 | Get Current Cartesian Position

  • Thanks SkyeFire your time,


    As i understand, my sps must be like this,

    Code
    ;************ X AXE **********
    
       ON_ERROR_PROCEED
       POSXact = $POS_ACT_MES.X*1
       IF $ERR.NUMBER>0 THEN
           POSXact=-9999
           ERR_CLEAR($ERR)
       ENDIF
    ;*****************************
    ;....

    multiplying with 1 does nothing except make more work for CPU.

    that will work but it will give you position value rounded to a millimeter because SIGNAL is an INT type, not a REAL. to send REAL value to PLC, you need to transfer bit-by-bit value from REAL to INT before assigning it to POSXAct for example.


    another workaround to preserve at least some of decimal places is to multiply REAL value by some factor (such as 1000.0). then receiving side should of course divide received value by same factor.

    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

  • AD
  • multiplying with 1 does nothing except make more work for CPU.

    that will work but it will give you position value rounded to a millimeter because SIGNAL is an INT type, not a REAL. to send REAL value to PLC, you need to transfer bit-by-bit value from REAL to INT before assigning it to POSXAct for example.


    another workaround to preserve at least some of decimal places is to multiply REAL value by some factor (such as 1000.0). then receiving side should of course divide received value by same factor.

    This is fine for my test, i just wanted to use value rounded to millimeter,

    Thanks for the information, I will think about it :)

  • multiplying with 1 does nothing except make more work for CPU.

    I try without but this line appear :


    Some values cannot be initialized correctly when a value of type 'REAL' is used for a parameter of type 'INT'.


    So i guess that $POS_ACT_MES.X is REAL and the signal a INT as you said, should I do any operations to make it INT? or make my Output REAL (that's why i multiplied by 1)


    Thanks panic mode

  • that is one of the annoyances in WoV... robot does not care about that and casts REAL to INT without issue or need for extra multiplication.

    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

  • Ok nice,



    I was searching about SIGNAL manual, I found that SIGNAL was declared as INT and can be max assign as 32 bits. But i didnt found how these bits take care about the negative numbers. Some of my coordinate looks like -1450.


    Do you have some informations about this ?

    Is there a bit of sign ?



    Thanks,

  • when signal is 32-bit (no more and no less) then it is a signed INT (SINT) and the most significant bit is a sign.


    if the signal is less than 32-bit wide, it is always unsigned (sign bit is chopped off).

    so in case one wants less than 32-bit signed value (SINT16 for example), programmer would need to ensure that value is interpreted correctly which is easy to do.

    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

  • The kuka plc I was working with is called ProConOs (IDE: Multiprog wt).

    There are several function blocks having direct access to the robot base system (like $POS_ACT_MES - 12ms)


    Suggestion: check with KUKA


    (you need this soft plc from kuka because they provide you the kuka specific function blocks)

  • when signal is 32-bit (no more and no less) then it is a signed INT (SINT) and the most significant bit is a sign.


    if the signal is less than 32-bit wide, it is always unsigned (sign bit is chopped off).

    so in case one wants less than 32-bit signed value (SINT16 for example), programmer would need to ensure that value is interpreted correctly which is easy to do.

    Thanks for the help, I will check this :)


    The format for the 32 bit is well known as two's complement. You can search for it, and will find many examples.


    Well, wasn't sur about it, thanks ! :)


    I see, I will send a mail to KUKA about this, thanks a lot !

  • Hi everyone, i'm coming with some results,


    To resume the thread, I'm searching to get the current cartesian position of the robot during a program to print it into a HMI.


    For this I used $POS_ACT_MES for each axes $POS_ACT_MES.X, $POS_ACT_MES.Y,$POS_ACT_MES.Z)


    And, in the loop of the SPS.SUB :

    And in the VAR_CONST

    Code
    ;************************************************
    GLOBAL SIGNAL POSXact $OUT[2160] to $OUT[2191]
    GLOBAL SIGNAL POSYact $OUT[2192] to $OUT[2223]
    GLOBAL SIGNAL POSZact $OUT[2224] to $OUT[2255]
    ;************************************************

    I installed my WorkVisual Project without problem. I start the robot. It was already at home position, no base and tool are declared, so $POS_ACT_MES shouldn't be valid. I take the smartpad,


    display -> variables -> unit -> POSXact


    then POSXact is equal to -9999 as mentioned in the sps in the case of error ($pos_act_mes not valid).


    So, I lunch the program of the robot, then the robot act as usual but POSXact doesn't make a move (stay at -9999).


    My program contain around 15 different points and it last for more than 7 seconds so I literally have the time to see the movements of POSXact ,


    I looked for any error in Smartpad but nothing happen,


    If you have any idea don't hesitate,


    Thanks a lot, :)

    Lucas

  • Of course,


    Base and tool are defined for the entire program, that's why i dont understand how POSXact stay at -9999.


    Thanks

  • maybe something else sets error and SPS keeps overwriting good value with 9999

    try clearing error before the first of your ON_ERROR_PROCEED

    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 see, i will try it tomorrow,


    I'm looking for the spec of ON_ERROR_PROCEED, I remember found it in a doc but cant get my hand on it ..


    EDIT :

    Quote

    Additional information about ON_ERROR_PROCEED is provided in the KU-KA System Software (KSS) service and programming manuals - KSS 8.4



    Thanks

    Edited 2 times, last by Lucasss ().

  • Why not use a cyclic Analog output? It's updated every 12 ms and there are plenty of way to create an almost real-time representation of axis or cartesian positions without the added expense of an RSI option package. It's limited to 4 concurrent channels which should be enough for 3-D. The description can be found on xpert.kuka.com under ID SE63407.

    Syntax

    Starting cyclical writing:

    ANOUT ON Signal name = Factor * Control element <±Offset> <DELAY = ±Time> <MINIMUM = Minimum value> <MAXIMUM = Maximum value>

    Ending cyclical writing:

    ANOUT OFF Signal name


    All the variables are REAL, as is $POS_ACT_MES and all other position or velocity variables.


    Although the Analog command was originally designed for synchronising a gluing process with TCP velocity, it should work with positions. The nice thing about the command is it can work in the advance run using planned positions, so by using $POS_ACT instead of $POS_ACT_MES and using a negative DELAY, it should be possible to overcome any system lag.


    It's easy to assign each $ANOUT[n] to the fieldbus IO in WorkVisual - you don't need a physical analog device - but only 16bit INT is supported. By manipulating the calibration factor, it's possible to determine the accuracy and range required.







  • Hi Razzzhead, it seems to be a very good idea,


    I checked how to map $ANOUT on workvisual but it is fully greyed and I cant connect them,



    Thanks !

  • Are you familiar with fieldbus IO mapping in WorkVisual? The help file is your friend. Assuming your HMI on which you want to display the position data is connected to the KRC via a fieldbus then it should be straightforward.


    In my example I have the KRC I/Os in the left window and the Fieldbusses in the right window. My bus is a Beckhoff Profibus EL6731-0010 slave. You have to have spare slots available in the map - I chose slot [22] in this example which has to be configured as 3x INT in the signal editor. Drag the $ANOUT[3]-[5] group from the left window to join 21.0001 - 21.0005 in the RH window and all three will show as mapped and turn from grey to green. Voila:-


  • No i'm not so familiar with WorkVisual, just started to work on it since april, this is a great alternative, i will try to work on this until I cant test my solution,

  • Update : The solution mentioned post #30 is totally working. No error declared and the value of position is visible every 24ms which is quick. Thanks everyone for help ! Have a nice day


    Lucas

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