Question about EthernetKRL

  • Hello,


    I'm working on a project where it's necessary to communicate between Main Control Unit (Just a PC) and KUKA KRC4. For that, Ethernet KRL 2.2 (for KRC4 8.3) package was chosen. Provided EthernetKRL documentation is quite brief, but enough to understand and ensure basic communication.

    My task involves quite intensive communication where MCU acts as server and robot as client. Lets say I have 10 different queries, some of them use binary stream, some XML data option. I use binary stream when robot asks server about some information\data availability (and server request: yes or no). If data\information is available robot reconnects with different configuration file and receives data as XML structure. The difficulty lies in the fact that some requests must occur in parallel, independent of each other, because the requests calls happen in different submits (yeah, multisubmit module). Right now, this system is implemented in the following way -> I have separate sub ("Networking_manager.sub" ;)) which cycles all possible request, checks if this particular type of request is active (they can be activated from different subs), and if it is -> creates connection with proper configuration file, sends request, receives answer from server -> deactivates request ->move to next request type. So, robot constantly bombards the server with requests. Some times it works, but sometimes I receive errors about lost connection. Even if every RET variable returns 0 as result. And so, based on all the information above:

    1. Is it possible to create multiple simultaneous connections from robot to server with EthernetKRL? This would solve the problem like a charm. Documentation states ("...The number of active connections is limited to 16."), but I didn't managed to test is successfully.

    2. In my mind, there is another implementation option. Just make large single request which will contain all smaller requests with their status (active\inactive) and all "answer" data. So robot and MCU can just ping pong this single large data butch, changing necessary parts of it to communicate. Is it good option from your opinion?

    3. How would you implement such communication with Ethernet KRL?


    Thanks in advance!

  • 1. Is it possible to create multiple simultaneous connections from robot to server with EthernetKRL?

    If i recall correctly Ethernet KRL allows only one server (on the robot side). But in your case server is external, so robot is acting as client. That means (as long as your server support it) you can create several connection to it, either from same or from different robots.


    2. In my mind, there is another implementation option. Just make large single request which will contain all smaller requests with their status (active\inactive) and all "answer" data. So robot and MCU can just ping pong this single large data butch, changing necessary parts of it to communicate. Is it good option from your opinion?

    We do not know your requirements and EthernetKRL documentation does not mention any kind of benchmark info (even for orientation). But there is no such thing as free lunch. The larger the telegram, the longer transmission time and fewer telegrams in same time frame are possible.

    3. How would you implement such communication with Ethernet KRL?

    Well... You read the manual, decide what you need, try to make it work. If you run into issues, solve them one by one or reconsider what is important for you.


    I find EKI documentation and examples not very good. There is a lot left to be desired. Had to spend a lot of time to get things working the way i intended (reconnections, buffering, checking buffer etc.). And it can be slow, specially when using extended submit. Different interpreters have different CPU quotas and extended submits are rather limited.


    Since KUKA really neglected debugging of submit interpreters, i write all code in SRC modules and do all testing and debugging using robot interpreter. When it works to my liking, program can be linked with main or one of extended submits. This also allows evaluation or comparison of performance.

    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

  • Quote

    If i recall correctly Ethernet KRL allows only one server (on the robot side). But in your case server is external, so robot is acting as client. That means (as long as your server support it) you can create several connection to it, either from same or from different robots.

    I'm using src modules to test things first, so sub modules were mentioned to give explanation of planned end system. I have written simple src module which tries to create two simultaneous connections from robot to server. Server is 100% capable to work with multiple connection form single client. Here is src module code:

    Here is "Call_to_server1.xml" internals:

    The difference between "Call_to_server1" and "Call_to_server2" are receive flag number (1 or 2) and different names for input and output buffers (with indices 1 or 2). External configuration contains right server connection parameters and they are the same for both configuration files.


    Considering basics of TCP\IP protocol, a connection or "socket" on server side is defined by combination of "Server IP, Server Port, Client IP, Client Port". So any other connection to the same server will have ether different Client IP or Client Port. The Client IP will be the same coz we are connection from the same robot. According to EthernetKRL documentation, we do not have access to port choice if KLI is acting as client, so, I suppose EthernetKRL package manages ports itself. So, in theory, my test program must work. But code gives EKI00023 error at line:

    Code
    RET2=EKI_Init("Call_to_server2")

    what means that - "The Ethernet connection has already been initialized with the function EKI_Init()." And documentation advices me to close active connection before creating new....

    Either, I'm doing something wrong, or it is not possible to make several simultaneous connections from single robot to the same server, even if documentation states it is possible.

  • Either, I'm doing something wrong, or it is not possible to make several simultaneous connections from single robot to the same server, even if documentation states it is possible.

    I'm pretty sure that parallel connections require separate ports for deconfliction.


    Also, in my experience (which is a few versions old now), opening and closing connections rapidly tends to cause errors. You might be better off creating some persistent connections and simply use some error trapping to delete and re-open the connection if/when there's a failure.

  • I'm pretty sure that parallel connections require separate ports for deconfliction.


    Also, in my experience (which is a few versions old now), opening and closing connections rapidly tends to cause errors. You might be better off creating some persistent connections and simply use some error trapping to delete and re-open the connection if/when there's a failure.

    I found a problem. Was not related to software part at all, a switch I used to create LAN network was guilty. So, now I can create up to 16 simultaneous connections as it stated in documentation.

    SkyeFire, how error trapping can be implemented? Through EKI_STATUS value control?

  • I'd have to dig out some archives, but IIRC, the SPS loop detected a connection failure by monitoring the $FLAG for the connection status (setup in the XML file), and a timeout on a heartbeat value being passed cyclically between the robot and the remote PC.


    In the event that the $FLAG went False, or a heartbeat timeout occurred, the SPS loop would stop running the EKI_SEND/GET routines, do a ClearBuffer and Delete on the connection, then re-open it.

  • Hi Danii
    I am going to work on a project involving simple communication between the KRC and a PC/Laptop. The configuration we are going to use is KRC as server and PC as client. Data exchange will be binary. Is there any update on your project and is there anything that I must look out for?

  • Hi Danii
    I am going to work on a project involving simple communication between the KRC and a PC/Laptop. The configuration we are going to use is KRC as server and PC as client. Data exchange will be binary. Is there any update on your project and is there anything that I must look out for?

    We are using xml data exchange option. Much much simpler, because xml allows to parse data with ease, for both, KRC and external PC. Of course it depends on amount and type of data you would like to send/receive. So SkyeFire asked right questions!

  • That, by itself, is fairly straightforward, and documented fairly well in the EKI manual. The details are where it gets interesting. What protocol are you planning to use? With what update rate? Foreground or background?

    Any particular reason? ASCII is easier. Also, how much data? Of what kind?

    Thank you for the response.
    For now the only reason to go for binary was that a previous colleague of mine was working with binary, The amount of data is not too much only the positions and velocities for now. We might add to the data that we are going to get but only at a later stage. For now the update rate has not been decided, but the speed of data acquisition isn't important at this stage. My own opinion was building around using XML instead, which seems to be the preferred choice here as well, so I will discuss this with my team. once we run some tests the data is going to be foreground.

    We are going to use python TCP socket to read the data into our PC as a first test and later on move to a companion PLC/HMI setup ultimately.

    For now we are examining the Manuals and post only if we run into some difficulties.

Advertising from our partners