Sending $POS_ACT_MES to a PLC with EtherCAT for position monitoring

  • Hello,


    I'm Aurélien Trolliet, automation engineer at L.E.S.S. SA. I've a little question for you guys, I'm trying to sent the actual position of my Kuka robot to a Beckhoff PLC for monitoring and my problem is : How would it be possible to do something like : SIGNAL $POS_ACT_MES.X $OUT[1218..1250], (I know that I can't do this like that it is just to give you an idea) ?

    The way I was thinking about, was to seperate the 32bits of the REAL variable and set the 32 outputs one by one but this value as to be refresh at every cycle of the controller and my programs on Kuka are sequentials.:thinking_face:

    For the rest (linking with the EtherCAT bridge and everything), I will not have any difficulties but my question is really on the first step.

    To be clear, I'm just asking for ideas of solution, i'm not asking you to give me a complete solution but I don't have a lot of experience with Kuka programmation.


    All the ideas are welcome and have a nice weekend :smiling_face_with_halo:

    (Sorry if I've made to much mistakes in English, I've done my best :winking_face:)


    Ow and I'm programming a KR 6 R900 robot, with a KRC4 compact controler KSS8.6.5 on Workvisual 6.0

  • If you insist on sending numbers through outputs, then convert the type from real (prob want to multiply by 100 to get two decimal places) to unsigned int and then send with signal, although using 19 outputs seems... inefficient. And that's just for X value.

  • Optimal control quality of the hydraulic axes is achieved through dynamic, highly-repeatable position measurement. The rod style BTL6 is ideal for position monitoring applications that do not require closed-loop control. The BTL6 single-connector system allows direct connection to existing EtherCAT installations.

  • Hi,


    Ok it's not as easy as I was thinking. So following your advice, I've added


    $config.dat

    SIGNAL POS_X $OUT[1219]  TO $OUT[1250]

    $sps.sub

    POS_X = REAL_TO_INT($POS_ACT_MES.X)

    I've made all the link with EtherCAT but It didn't work, I only have 0 for every values. I'm not sure to have understood when sps.sub is running, it's not really writen in the documentation. Because in Debug I can see the value of $POS_ACT_MES.X which is arounf -445 but POS_X always stay at 0. I've tried this with the Cell.src while going to a HOME position in T1.

    Do I have to do something to run sps.sub ? Or I'm doing something else wrong ?

  • like with all programs....everything has right place... and it matters where inside SPS you add your code.

    if you put something before LOOP, it will only be processed once when SPS is started.

    if you put it inside LOOP-ENDLOOP, it will be processed continuously while SPS is active.

    if you put it after ENDLOOP, it will never be processed... unless there is something allowing to exit loop...

    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

  • there is only couple of reasons that could happen, for example:


    1. something else is clearing these outputs.

    2. the function is not working (maybe you made a typo)

    3. your submit is not running (or at least not reaching that line)

    4. you are not monitoring entire range (32-bits)

    5. your signal declaration is not valid (not exactly 32 bit) ... in fact that seem to be the case, i see 33 bits. so $CONFIG.DAT does not even compile and must have red "X" across icon...:grinning_squinting_face:


    to test case #1, use single variable monitor and manually assign some value(s) to POS_X and see if the assigned outputs stay or not. or just set them one by one manually. if they keep state, then nothing is clearing them. if they cannot retain assigned state you need to look for code that is resetting them.


    to test case #2, create new Expert Module and put the same line in there. run it and see if you get correct output. easier to step through code and fix any errors.


    to test case #3, replace that line in SPS with something like

    POS_X= -1

    or

    POS_X=POS_X+1

    and check the outputs



    to test case #4.... do you actually know what the outputs should be if input value is -445?


    in binary that should be

    1100 0011 1101 1110 1000 0000 0000 0000


    so the higher bits should be set... but the first few (15 to be exact) are FALSE.

    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 it works ! Thanks ! In fact I'm feeling a little bit stupid now because I've done all the test to be sure that it was the Submit that wasn't running and during those test I realise that the top left big color square wasn't green but red with a big "S" in the middle. Could it be "S" for "Submit" ... ? I clicked on the button and writen in caps I could read "SUBMIT Interpreter with a very detailed error list ... :neutral_face:

    So yes the problem was that the submit was stopped by an error. After sending $POS_ACT_MES.X,Y,Z,A,B,C I was sending $POS_INT but it didn't support because it as no values.

    I just remove $POS_INT from sps.sub and put it in my interrupt routine and it's working fine now.

    Thank you very much for your help :thumbs_up:

Advertising from our partners