KUKA KRL , KLI Interface

  • Hello guys,


    I am woking with kuka robot and I have developed a connection between kuka as client and computer as server via KUKA KLI interface. I am sending and receiving messages to and from kuka. The question is:


    1) I want to put conditional (IF statement) in KUKA KRL. I want to make the robot move left when the python program send FALSE message as in xml format to robot and I want to turn right if I receieve TRUE message from python.


    Is there is a possible way to do it. I am stuck in this problram for almost 2 weeks now. Any kind of help will be appereciated.


    Best regards:smiling_face::smiling_face::smiling_face:

  • HI.

    I don't know very well what you want to do, but with a signal or variable that links you can do what you're saying. Inside the logic of the "if"

  • This is the part of my code which I am talking about. I wait for $FLAG[2] and server will send a message to kuka krl . If the server sends a XML message containing TRUE then the Robot should move right else left

  • I am trying to communicate in the same way as the shahzaib says . i am using the code like this


    DEF NEWMODULE()

    BinaryStream()


    LOOP


    IF Bytes[2]=="01" THEN


    SPTP XP1


    ENDIF


    ENDLOOP

    END





    i have called the binarystream program of krl. but the robot is not moving to the point XP1. BUt it is moving in a different direction to some other point which is not defined.

  • if that motion is executed, robot is moving towards THAT point. no question...


    problem is you are trying to use KRL commands instead of inline forms.


    inline form motion instructions do a lot of things including setting speed, tool, base etc. which you are not doing here. so robot is going to xP1 using some other coordinate system... but it is still moving to xP1

    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

  • Basic debugging.


    What is the value of the string BYTES[] when this happens?


    This code makes no sense. It only has one point -- it's not possible for the robot to move to "some undefined point".


    This code lacks any $TOOL or $BASE settings -- how do you know you have the correct values set when this program runs?

  • yes it worked well . thank you.i gave the base and tool to the program like this $TOOL=$TOOL2(FP1) and for base $BASE=$BASE(FP1.BASE_NO).

    if i send a particular message from my server, the kuka as a client will response to the motion which i defined in my program.

  • Hello SkyeFire,


    The code is working but the thing is MY_ACK == TRUE. This command is always true. Even I send a XML message form my python code server which is false it will take MY_ACK == TRUE and movee tot he position defined.


    Again, I send a XML message from python server and I want to know how can I combine this XML python message with the KUKA KRL IF command. I hope you can understand my question. Thanks in advance.

  • Is the program code you posted before accurate? Because you're doing the EKI_ClearBuffer before the EKI_GetBool. I'm surprised the EKI_GetBool isn't generating an error -- check the value of RET immediately after the EKI_GetBool command.


    Also... why are you waiting for $FLAG[2] after the EKI_GetBool? You need to follow the sequence:

    1. Wait for Flag

    2. EKI_Get

    3. EKI_ClearBuffer

    4. Flag=False

  • Because this $FLAG[2] is the XML message I will get from python server. as long as I do not recieve the XML messahe the program will wait for $FLAG[2].

    How can I check the value of RET after the EKI_GetBool?


    My previous code was in that order:


    1. Wait for Flag

    2. EKI_Get

    3. EKI_ClearBuffer

    4. Flag=False


    But I did not achieve the expected results.

  • I don't know where you're declaring RET, but it has to be a variable of type EKI_STATUS. This is a STRUC type variable described in detail in the EthernetKRLXML manual. You can access it's values just like any other variable, inside a program or on the SmartPad using the Variable Display or the


    You did not post your XML channel file, so I assume that the RECEIVE SET_FLAG value is 2. So $FLAG[2] should be set True by the EKI comm driver whenever a datagram is received into the EKI buffer, and your application program has to take charge of setting that $FLAG back to False again. You must carry out any EKI_GET commands before the EKI_ClearBuffer, otherwise you're trying to read an empty buffer.

    "Did not achieve the expected results" tells me nothing. WHAT did the robot do, EXACTLY? Without DETAILS, it is IMPOSSIBLE to provide any detailed assistance.

  • i too have the same problem

    ,as long as EKI do not read the XML full sensor data the program will wait for $FLAG[2].

    How can I check the value of RET after the EKI_GetFrame? I am using

    RET=EKI_GetFrame("XmlCallBack","Sensor/Read/xyzabc",valueFrame).

    i want to see the value of valueFrame in smartpad like display->single->Varaible->valueFrameThe KRL program is waiting for the flag[1], it doesn't move to the next level of execution. i tried using, flag[1] =true . it doesn't change.it is till waiting for the flag[1]. it smart pad it set up the message as, interrupt is set on FLAG[1] .

  • RET=EKI_Init("XmlCallBack")


    RET=EKI_Open("XmlCallBack")

    RET=EKI_SetFrame("XmlCallBack","Robot/Data/LastPos", TOOL_DATA[1])


    RET = EKI_Send("XmlCallBack","Robot")

    WAIT FOR $FLAG[1]


    RET=EKI_GetFrame("XmlCallBack","Sensor/Read/xyzabc",valueFrame)


    RET= EKI_ClearBuffer("XmlCallBack","Sensor/Read/xyzabc")

    $FLAG[1]=FALSE

    RET=EKI_Close("XmlCallBack")


    RET=EKI_Clear("XmlCallBack")



    this is the part of my program. i want to display the variable value of "valueFrame" in kuka smartpad. any idea with this please? help

  • if i send the valueframe data from my server and check the valueframe in the (single->variable->Valueframe), there is no data it shows... but there comes the message in kuka smartpad "OBJECT IS NOT AVAILABLE IN THE FILE YOU SPECIFIED". The below is the program logic which i am using now.



Advertising from our partners