KRC4 XML data transfer

  • Hi,


    I need to write some KRL code that uses Kuka KRL XML to transfer data between a program on the PC and a program on the robot. Ethernet communication is working between kuka and external PC.


    KRC4 & KSS 8.x


    Please guide me to transfer data using XML.


    This forum is really helpful for newbie. There is a lot of information for KRC2 but I need information for KRC4.

  • Hello,


    There are two different tools, the transfer of data with EthernetKRL in XML. This is not the same as the one with RSI.
    With RSI, you can use a specific block to handle the transfer of XML files.


    The how to code on the KRL side is explained on the manual I believe.
    But in order to send some data to the robot, you need to have a server on your computer that will answer the robot requests.


    I cannot help much more, I am currently doing this with the RSIEthernet block and the most complicated part for me is not the robot configuration but the development of the server on the PC.


    Alex

  • RSI and EKX are both optional tech packages which must be purchased and added to the robot. EKX for is transferring data on demand. RSI is for realtime high-speed cyclic data transfers for controlling robot motion via remote devices.
    Once you choose which Tech Package suits your application and install it, you will need to study the documentation and the provided example programs (and historical conversations here on the forum), in order to create your own server program which the robot can communicate with.

  • Thank you skyfire,


    can i know the information from where i can buy the package and how much the cost will be for that ?
    which one suit on my krc4 version ?
    It will only transfer some coordinates data to the Robot. Robot will draw the coordinate points on a paper/board.


    I am interested on EKX. It would be helpful for me, if i could get some more details about these packages.



    Thank you again..

  • You would have to contact KUKA Roboter directly for pricing and details. Provide them with the serial# of your robot and the version of KSS it is running, and they should be able to tell you exactly what packages are compatible and what they cost.

  • I can't speak to the WorkVisual code -- my knowledge of EKX is limited to pre-KRC4 versions. But typically, KUKA always includes some example server code. I was incorrect about it being in the /DOC directory, however -- at the same level as the DOC directory, there should be a Directory called Demo, which (at least in the old versions) contained example code for both KRL and the C code for a matching server program.

  • Hi bad boy,


    Sorry for the delay I had been in training.


    For the server com, I have the following code :


    using System;
    using System.Net;
    using System.Net.Sockets;
    using System.Text;
    using System.Threading;


    namespace UDPServeur
    {
    public class Program
    {
    private static Thread _thEcoute;


    private static void Main(string[] args)
    {
    //Préparation et démarrage du thread en charge d'écouter.
    _thEcoute = new Thread(new ThreadStart(Ecouter));
    _thEcoute.Start();
    }


    private static void Ecouter()
    {
    Console.WriteLine("Préparation à l'écoute...");


    //On crée le serveur en lui spécifiant le port sur lequel il devra écouter.
    UdpClient serveur = new UdpClient(6008);


    //On crée la trame XML de réponse
    System.Xml.XmlDocument SendXML = new System.Xml.XmlDocument(); // XmlDocument pattern


    // On charge le modèle de réponse
    SendXML.PreserveWhitespace = true;
    SendXML.Load("C:\\Documents and Settings\\alexandre\\Mes documents\\Visual Studio 2010\\Projects\\serveurUDPsdz\\ExternalData.xml");


    //Création d'une boucle infinie qui aura pour tâche d'écouter.
    while (true)
    {
    //Création d'un objet IPEndPoint qui recevra les données du Socket distant.
    IPEndPoint client = null;
    Console.WriteLine("ÉCOUTE...");


    //On écoute jusqu'à recevoir un message.
    byte[] data = serveur.Receive(ref client);
    //Console.WriteLine("Données reçues en provenance de {0}:{1}.", client.Address, client.Port);


    //Décryptage et affichage du message.
    string message = Encoding.ASCII.GetString(data);
    //Console.WriteLine("CONTENU DU MESSAGE : {0}\n", message);


    // wait for data and receive bytes


    // convert bytes to string
    string strReceive = message;


    // take a look to the end of data
    if ((strReceive.LastIndexOf("</Rob>")) == -1)
    {
    continue;
    }
    else
    {
    // mirror the IPO counter you received yet
    string strSend = SendXML.InnerXml;
    strSend = mirrorIPOC(strReceive, strSend);


    // données envoyé au client
    //Console.WriteLine("Données envoyées au client {0}:{1}.", client.Address, client.Port);
    //Console.WriteLine("CONTENU DU MESSAGE : {0}\n", strSend);


    // send data as requested
    byte[] msg = System.Text.Encoding.ASCII.GetBytes(strSend);
    serveur.Send(msg, msg.Length, client);
    }
    strReceive = null;
    }
    }


    // send immediately incoming IPO counter to have a timestamp
    private static string mirrorIPOC(string receive, string send)
    {
    // separate IPO counter as string
    int startdummy = receive.IndexOf("<IPOC>") + 6;
    int stopdummy = receive.IndexOf("</IPOC>");
    string Ipocount = receive.Substring(startdummy, stopdummy - startdummy);


    //IPOC arrivé
    Console.WriteLine("IPOCclienttoserv {0}", Ipocount);
    //Console.WriteLine("IPOCclienttoserv {0}, {1}", startdummy, stopdummy);


    // find the insert position
    startdummy = send.IndexOf("<IPOC>") + 6;
    stopdummy = send.IndexOf("</IPOC>");


    //IPOC arrivé
    //Console.WriteLine("IPOCservtoclient {0}, {1}", startdummy, stopdummy);


    // remove the old value and insert the actual value
    send = send.Remove(startdummy, stopdummy - startdummy);
    send = send.Insert(startdummy, Ipocount);


    // send back the string
    return send;
    }
    }
    }



    This is only a server that receive data according to an example XML frame. Then send it back. It is very basic, however it might help you start.
    Only one point. In my case, as I work with RSI for real time data transmission, C# seems to be a bit too slow with my computer. It is not really able to send data every 4 ms.
    I know that C++ server can have better time response.


    Some comments are in french, sorry for that. :icon_smile:


    If it helps, could you post back the improvements ? I do not have much time to work on this as it is not my main work so it would help me also if you can share your work.
    If not possible because confidential I understand :icon_wink:


    Thanks
    Alex


  • Hi Alex2070,


    Thank you for your code.


    I need some more information, I am a newbie and don't have too much experience on kuka and c#. I already checked it but it did not work. I think you already know about my project from this conversation. If you are working on similar robot controller and want to share some more information then it will be helpful for me. I don't have too much time to finish it. It would be helpful if you could reply early. I have no problem to share my work with you, if it can help you on your learning process. I appreciate you for the time you gave to help me from your busy schedule.


    you are talking about using c#, but did you checked the robot?
    did you try to send and recive some data from the robot, using telenet or utility like socket workbench?
    first of all check the robot side, i sent you in private message an examples for configure and getting xml data.
    if all working in robot side, then you can move to ask about c#.
    you can also google for c# tcp client, and got a banch of c# codes


  • Hi Alex2070,


    Thank you for your code.


    I need some more information, I am a newbie and don't have too much experience on kuka and c#. I already checked it but it did not work. I think you already know about my project from this conversation. If you are working on similar robot controller and want to share some more information then it will be helpful for me. I don't have too much time to finish it. It would be helpful if you could reply early. I have no problem to share my work with you, if it can help you on your learning process. I appreciate you for the time you gave to help me from your busy schedule.


    This program is working for RSI Ethernet configuration. As you do not use RSI, it is mostly a guide on how to build your own solution.
    The first step as said above by zeev is to make sure you have the communication open between the robot and the computer.
    Then you can use some sniffer on your computer to check that the robot try to connect to your PC and see if your server answer it.

Advertising from our partners