Hello,
I'm currently working on sending data from a server to a kuka robot with little luck getting data through. The goal is: a scanner will scan material for defect points, and the robot will receive those points using EthernetKRL. Right now the server sends the data manually (I use a setup program to send the data myself, no auto-response yet). I confirmed that the server works with my laptop, using PuTTY to connect to the same port, and manually send data over. To keep things simple I started with sending a bool, a string, an int, and a real to test the data transfer.
So far the program I have to initialize and open a connection to the server looks fine. I also included an interrupt to wait for data to be available after it has been sent from the server. The "Alive" flag[98] turns true, letting me know the connection is made. Then I'll manually send the data from the server, but the robot program just sits there waiting for the flag to let it know that data is available. I don't get any notifications from the EKI_CHECK() instructions I put in, so I'm not sure how else to check what's gone wrong.
I included my Get_Defects() code below. You'll notice Defects_Read[] is initialized (declared in the .dat file, so not shown here), but it isn't used yet. This is where I'll eventually be copying an array of reals once I get data transferring correctly. I also included my repairs.xml file. You'll see the real array is commented out.
I'm very new to data transfer and how that works, as well as to kuka robots in general. I'm hoping for some ideas on what I can do/read to figure out why the data isn't transferring to the robot, but I can do it on my laptop using PuTTY. Even questions I can ask the Kuka help desk, or things I need answered about the server end. Any help would be greatly appreciated.
Thanks!
DEF GET_DEFECTS()
; Declarations
$FLAG[99]=FALSE
;Initialization
;FOLD INI;%{PE}
;FOLD BASISTECH INI
GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
INTERRUPT ON 3
BAS (#INITMOV,0 )
;ENDFOLD (BASISTECH INI)
;FOLD USER INI
; Initialize or clear the Defects Array before putting new values into it
FOR i = 1 to 512 STEP 1
Defects_Read[i] = 0
ENDFOR
; Interrupt program and get data when available
INTERRUPT DECL 89 WHEN $FLAG[100]==TRUE DO GET_DATA()
INTERRUPT ON 89
;ENDFOLD (USER INI)
;ENDFOLD (INI)
; Initialize and open the XML file from the Scanner
RET = EKI_Init("repairs")
EKI_CHECK(RET,#notify,"repairs")
RET = EKI_Open("repairs")
EKI_CHECK(RET,#notify,"repairs")
;wait until data read
WAIT FOR $FLAG[99]
; Close the XML file and clear the values stored from it
RET = EKI_Close("repairs")
EKI_CHECK(RET,#notify,"repairs")
RET = EKI_Clear("repairs")
EKI_CHECK(RET,#notify,"repairs")
END
DEF GET_DATA()
DECL INT j, ValueInt
DECL BOOL ValueBool
DECL REAL ValueReal
DECL CHAR ValueChar[256]
FOR j=1 TO 256
valueChar[j]=0
ENDFOR
valueInt=0
valueReal=0.0
valueBOOL=FALSE
; Copy defect values from the Defects variable in the
; XML file to the Defects_Read variable in the KUKA
; Wait for the flag signaling all values have been read before closing & clearing
;RET = EKI_GetRealArray("repairs","Scanner_To_Robot/Defects",Defects_Read[])
RET=EKI_GetBool("repairs","Scanner_To_Robot/TestVar/VarBool", ValueBool)
RET=EKI_GetInt("repairs","Scanner_To_Robot/TestVar/VarInt", ValueInt)
RET=EKI_GetString("repairs","Scanner_To_Robot/TestVar/VarChar", ValueChar[])
RET=EKI_GetReal("repairs","Scanner_To_Robot/TestVar/VarReal", ValueReal)
; Reset flags
$FLAG[100] = FALSE
$FLAG[99] = TRUE
END
Display More
<ETHERNETKRL>
<CONFIGURATION>
<!--"EXTERNAL" Describes the external module (scanner), pg 21-22 in EthernetKRL manual-->
<EXTERNAL>
<TYPE>Server</TYPE>
<IP>172.31.1.100</IP>
<PORT>26000</PORT>
</EXTERNAL>
<!--"INTERNAL" Describes the internal module (KRC), pg 22-24 in EthernetKRL manual-->
<INTERNAL>
<ENVIRONMENT>Program</ENVIRONMENT>
<BUFFERING Mode="FIFO" Limit = "512"/>
<BUFFSIZE Limit="65534"/>
<TIMEOUT Connect="10000"/>
<ALIVE Set_Flag="98" Ping="200"/>
<PROTOCOL>TCP</PROTOCOL>
<MESSAGES Logging="error" Display="error"/>
</INTERNAL>
</CONFIGURATION>
<RECEIVE>
<XML>
<ELEMENT Tag="SCANNER_TO_ROBOT/TESTVAR/VARBOOL" Type="BOOL"/>
<ELEMENT Tag="SCANNER_TO_ROBOT/TESTVAR/VARCHAR" Type="STRING"/>
<ELEMENT Tag="SCANNER_TO_ROBOT/TESTVAR/VARINT" Type="INT"/>
<ELEMENT Tag="SCANNER_TO_ROBOT/TESTVAR/VARREAL" Type="REAL" Set_Flag="100"/>
<!--<ELEMENT Tag="SCANNER_TO_ROBOT/DEFECTS" Type="REAL" Set_Flag="100"/>-->
</XML>
</RECEIVE>
</ETHERNETKRL>
Display More
Robot: KR 90 R3700K Prime C4 FLR
Controller: KR C4 NA
KSS: V8.3.33
Kernel: KS V8.3.329
EthernetKRL: Version 2.2.9
Robot IP Address: 172.31.1.147
Server IP Address: 172.31.1.100
Server Port: 26000
Laptop IP Address: 172.31.1.230