Hello all
I have a KR C4 that I would like to couple with a cognex using EthernetKRL.
1. I installed the package (EthernetKRL) and tested all the samples provided with using the server.exe program and the example server "XmlServer" with a Hyperterminal as it was mentioned in the manual.
2. On cognex (In-Sight Explorer) I have a program that extracts Blods and transmits the data to an external system via TCP / IP. I tested it with hypeterminal using the cognex as server to transmit the data at first, and transmit data from hyperterminal in a second time.
Both are working perfectly.
3. But I can not communicate the kuka to the cognex, I used kuka as server and cognex as client and inverted but it does not work. The flag tells me that there was no connection.
Can you help me to solve this problem?
Communication kuka/Cognex using EthernetKRL (TCP/IP protocol)
-
Abdoul -
May 18, 2019 at 2:01 PM -
Thread is marked as Resolved.
-
-
you just stated that you tested stock samples but provided no program example or description of what you are actually doing. obviously some adaptations are needed.
so, read READ FIRST and try again
-
I tried to make a communication between a cognex (In-Sight 5100) and a kuka model KR 6 R700 sixx, type of controller KR C4 compact version KSS 8.3
1.I have the EthernetKRL package installed, but I can not get a connection between cognex / kuka. Nothing happens when I launch my connection program (below)
2.Is there a specific library that allows communication between kuka / cognex? -
[size=1em]
No... Ethernet communication is using Client-Server model.
There is no Server-Server model.[/size]
[size=1em]
You already mentioned that IS5100 is working as a Server, and i doubt you can change that behavior.[/size]
[size=1em]KRC can be either Client or Server but ... since IS5100 is acting as a Server, KRC must be acting as a Client...[/size]
-
Yes I know for the ethernet communication model (server / client), IS5100 can work as a server or as a client too.
I tried communication using KRC as server and IS5100 as client it does not work. After I invert the model using this time KRC as client and IS5100 as the server and this the same result (still nothing, no connection).
Before trying the communication between KRC and cognex, I performed a series of tests with hyperterminal:
--with KRC
--and with cognex too
the communication worked for both. -
what are the settings? network, XML config?
you can use EireShark to monitor communication and see what the difference is between samples (working) and your code (not working) -
In KRC I have an XML file (image attached) in which I made my configuration and I use the same configuration data on the side of IS5100 (port, IP address).
I have a flag that tells me if the connection is established or not.Code
Display More<CONFIGURATION> <EXTERNAL> <TYPE>Client</TYPE> </EXTERNAL> <INTERNAL> <ENVIRONMENT>Program</ENVIRONMENT> <BUFFERING Mode="FIFO" Limit="10"/> <BUFFSIZE Limit="16384"/> <TIMEOUT Connect="60000"/> <ALIVE Set_Out="666" Ping="200"/> <IP>192.1.10.20</IP> <PORT>54600</PORT> <PROTOCOL>TCP</PROTOCOL> <MESSAGES Logging="error" Display="disabled"/> </INTERNAL> </CONFIGURATION>
-
As Panic said, are you using WireShark to capture the network traffic and compare the working and non-working packets?
Your XML config file is set to use port 54600 -- did you configure the Cognex to use Telnet on that same port?
How is the camera being triggered? Unless you're sending 'SE8' or something similar to the camera, it can only be triggered by the hardware input.
Your KRL code has no EKI_GET commands.
Your KRL code is using $FLAG[1] to detect the connection, but you do not have that flag configured in your XML. You also have no flag configured for Data Received.
Why are you trying to configure the robot as the server? It should be far simpler to let the camera act as the server, send trigger commands via raw ASCII, and parse the returned string.
-
Thanks
the connection is established in server / client mode (KRC is the server) as I wanted but I can not read and write data on the camera software.
The instructions for the transmission and reception of EthernetKRL data are not recogiled by IS5100.
Is there a specific library to allow the exchange of data between KRC / IS5100 without ambiguity -
There was a KUKA.VisionCom but not sure if it is still available. Talk to your KUKA rep
-
If you're trying to connect to the Cognex Telnet interface, you have to use RAW mode in EKI and build your strings correctly for the Cognex Native Mode commands (and append the ASCII codes for CR and LF to the end). And build a Telnet-send element into the Cognex program, and then pull the returned string from the EKI buffer and parse it into its components in KRL.
And if you want help, try answering the questions. "Cannot read/write data on the camera software" tells us NOTHING about the DETAILS we need to know in order to have any chance of offering you any practical assistance.
-
Thanks,
I contacted kuka to ask them for the library kuka.VisionCom but they told me to use EthernetKRL to do frame exchanges with the camera (they did not mention kuka.VisioCom).1. SkyeFire@ I did not quite understand what you mean by "create your channels correctly for the native cognex mode control", I used RAW mode in EKI for data reception and in my program KRL I uses the CAST_TO() and CAST_FROM() instructions for sending and receiving data (see attached code).
2. In my cognex program I created a TCPDevice("IP robot","Port","Packet type","Timeout") and with a WriteDevice("Evenement","Device","Data",[Data1,Data2...]") I send the data, does this correspond to the cognex telnet sending element that you are talking about?
can you enlighten me a little, in advance thank you.Code
Display MoreFichier Configuration<CONFIGURATION> <EXTERNAL> <IP>192.168.1.99</IP> <PORT>59152</PORT> <TYPE>Server</TYPE> </EXTERNAL> <RECEIVE> <RAW> <ELEMENT Size="10" Set_Flag="1" Type="BYTE" Tag="Buffer"/> </RAW> </RECEIVE> <SEND/> </ETHERNETKRL> </CONFIGURATION>
Code
Display MoreProgramme KRLDEF BinaryFixed( ) ;FOLD Declaration DECL EKI_STATUS RET CHAR Bytes[10] INT i INT OFFSET REAL valueReal INT valueInt;ENDFOLD (Declaration) BAS (#INITMOV,0 ) ;FOLD Initialize sample data FOR i=(1) TO (10) Bytes[i]=0 ENDFOR OFFSET=0 valueReal=0 valueInt=0;ENDFOLD (Initialize sample data) RET=EKI_Init("BinaryFixed") RET=EKI_Open("BinaryFixed") OFFSET=0 CAST_TO(Bytes[],OFFSET,34.425,6743) RET = EKI_Send("BinaryFixed",Bytes[]) WAIT FOR $FLAG[1] RET=EKI_GetString("BinaryFixed","Buffer",Bytes[]) $FLAG[1]=FALSE OFFSET=0 CAST_FROM(Bytes[],OFFSET,valueReal,valueInt) RET=EKI_Close("BinaryFixed") RET=EKI_Clear("BinaryFixed") END
-
You have both the KRC and the Cognex set up as Clients. One has to be a server, the other has to be a client.
Look up "Native Mode Commands" in the Cognex documentation. That can be carried out using simply ASCII strings, sent Raw via EKI, with no CAST instructions.
-
Thank you for your answer
KRC is the client and cognex the server. I read the native command doc of cognex but I can not use them in/with EthernetKRL.
But I can send as you said a character for the moment since EKI using the Raw format and I recover it on cognex in ASCII format (for example Eki_Send ("BinaryFixed", Bytes []).1. If I want to send real values, should I code in ASCII characters?
2. If I send more data from EKI how to sort the cognex side to the recovery (because in cognex I use a TCTDivice to read the data send by EKI)
-
If you're using Native Mode Commands, stick with ASCII, don't mess with bytes. XML config must be Raw.
Build your command string using SWRITE functions in KRL. Then you will have to directly append the CR&LF characters via direct ASCII value manipulation, like this:
Code
Display MoreDEF SendCommandToCognex (FI_chCommandString[]) DECL STATE_T _State DECL INT _nOffset DECL CHAR FI_chCommandString[] DECL CHAR _chCommandString[100] _nOffset = 0 SWRITE(_chCommandString[], _State, _nOffset, "%s,", "SE8") _chCommandString[STRLEN(_chCommandString[]) + 1] = 'H0D' ; append CR _chCommandString[STRLEN(_chCommandString[]) + 2] = 'H0A' ; append LF ; put EKI_SEND commands here END
The Cognex depends on seeing the CR&LF characters when using Telnet-style commands, but they can't be added into a string normally, hence the workaround.
The return data from the Cognex should be, IIRC, comma-separated. Once you use the EKI_GET commands to pull the string from the EKI buffer, you can use CREAD to parse it into usable variables.
-
Thank you for the feedback
it works with the SWRITE function I can send any kind of data to the cognex.
But I don't understand what is the FI_chCommandString [] variable that you used in the program above?
-
Whoops. I got my samples mixed together.
Basically, FI_chCommandString would be a string received as an argument by the SendCommandToCognex().
Replace "SE8" in the SWRITE with FI_chCommandString[], and SendCommandToCognex() would act as a simple "formatter" -- whatever string argument was sent to the subroutine as FI_chCommandString[] would have CR&LF appended, then the result (_chCommandString[]) would be passed to the EKI_SEND function.
-
SE8 is a native telnet command from cognex, does cognex identify it as a command or as a simple datum?
For example with the attached code I can send data that is read by the device on cognex (image attache capture0) and I send a data to KRC at the same time.
Code
Display MoreRET=EKI_Init("BinaryFixed") RET=EKI_Open("BinaryFixed") SWRITE(_chCommandString[],_STATE,_OFFSET,"%r,","7Ak3") _chCommandString[STRLEN(_chCommandString[])+1]='H0D' _chCommandString[STRLEN(_chCommandString[])+2]='H0A' RET =EKI_Send("BinaryFixed",_chCommandString[]) WAIT FOR $FLAG[1] wait sec 2 RET=EKI_GetString("BinaryFixed","Buffer",_chCommandString[]) $FLAG[1]=FALSE WAIT SEC 2 RET=EKI_Close("BinaryFixed") RET=EKI_Clear("BinaryFixed")
Now I would like to use the native commands (image attache capture2) to trigger events on cognex, but each time when I use a command (SE0 for example) it displays it on the device and does not execute the command .
Do you have an idea? -
"SE8" is, IIRC, the basic Trigger command for the Image object located in cell A0. It does not connect to a TCPDevice object. There are several similar commands, all detailed in the Native Command sections of the InSight documentation.
-
yes I read the documentation on Native commands of InSight but it does not work when I send it, nothing happens.
I already realized an application with a Robot Staubli RX60 couple with cognex (pick and place with vision) but I had a library that allowed me to run Native commands from InSight since RX60.
But with kuka I can not send Native commands via EthernetKRL. -