Freitag, 18. Mai 2012, 17:50 UTC+1

Sie sind nicht angemeldet.

  • Anmelden
  • Registrieren

dacripple

Anfänger

Beiträge: 1

1

Samstag, 3. Dezember 2011, 18:50

Probleme mit KRL XML

Hallo zusammen,
ich habe ein Problem mit der KRLXML Paket.
Die Verbindung funktioniert so weit, wir können mit der mitgelieferten Beispielsoftware, sowie mit dem Beispiel-Roboterprogramm Punkte über Ethernet verschicken.
Jetzt wollten wir versuchen die XML-Dateien und das Roboterprogramm auf unsere Bedürfnisse anzupassen.
Wir wollen 2 Punkte (also 2 FRAMES) gleichzeitig übertragen. Der Roboter soll diese dann nacheinander anfahren.
Unser Problem: Die KRC verbindet sich mit dem PC, aber wenn wir das XML-File(ExternalData.xml) von PC->KRC versenden steht im Roboterprogramm nur immer
z.B. (X 0, Y 0, Z 0, A 0, B 0, C 0) drin. Woran kann das liegen? An den XML-Files? Am Roboterprogramm?
Vielen Dank im Vorraus!

Auf dem KUKA-Roboter liegen folgende XML-Dateien:
SampleSensor.xml:

Quellcode

1
2
3
4
5
6
7
8
<Elements>
<Element Tag="ExternalData" Type="STRUCTTAG" Stacksize="1" />
<Element Tag="ExternalData.TString" Type="STRING" Size="80" Stacksize="1" /> <Element Tag="ExternalData.Frames" Type="STRUCTTAG" Stacksize="5" OnTagSetPort="1" /> 
<Element Tag="ExternalData.Frames.XFrame" Type="FRAME" Stacksize="10" /> 

<Element Tag="ExternalData.Boolean" Type="STRUCTTAG" Stacksize="5" />
<Element Tag="ExternalData.Boolean.CState" Type="BOOLEAN" Stacksize="5" />
</Elements>

SampleSensor+.xml:( Zum Versenden Roboter-> PC, nutzen wir nicht)

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<Robot>
 <Data>
  <ActPos   X="" Y="" Z="" A="" B="" C="" />
  <LastPos  X="" Y="" Z="" A="" B="" C="" />
 </Data>
 <Status />
 <Mode />
 <Complex>
  <Tickcount />
 </Complex>
 <RobotType>
  <Robot>
   <Type></Type>
   <Serial></Serial>
  </Robot>
 </RobotType>
 <Any A="" B="" C="" />
</Robot>

XmlApiConfig.xml:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0"?>
<!-- KUKA Roboter GmbH                                                       -->
<!--                                                                         -->
<!-- 'InitOnce'   use false only                                             -->
<!-- 'Channel'    represents a connection to a Sensor. Every channel has     -->
<!--              the following parameters                                   -->
<!-- 'SensorName' is the name you give to a sensor. In KRL it serves         -->
<!--              as a handle to this channel. If the sensor                 -->
<!--              name, for example, is 'StackCam' there has to be a file    -->
<!--              called 'StackCam.XML' witch holds the information of the   -->
<!--              associated  ring buffers  (XML tags)                       -->
<!-- 'SensorType' is the type or the model name of a sensor.                 -->
<!-- 'TCP_IP'     holds information about the type of connection, TCP/IP,    -->
<!--              No other then TCP_IP is realized jet.               -->
<!-- 'IP'         holds the IP of the sensor.                                -->
<!-- 'Port'       holds the sensor port number of the port you want to       -->
<!--              connect to.                                                -->
<!-- 'Route'      if set to 'true' the connection will use ROUTE.EXE. If     -->
<!--              set to 'false' it will establish a direct connection.      -->
<!-- 'MapPort'    up to now should be always the same as 'Port'.             -->
<!--                                                                         -->
<XmlApiConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XMLCommunicationSetup.xsd">
<!--   -->
<!--   -->
<XmlApiParam InitOnce="false"/>
<!--   -->
<!-- USE DEMOSERVER -->
<Channel SensorName="SampleSensor" SensorType="SXT">
 <TCP_IP IP="10.1.2.24" Port="6008" Route="true" MapPort="6008"/>
</Channel>
<!-- END DEMO -->
</XmlApiConfig>

Die XML-Datei die wir versenden wollen sieht z.B. so aus:
ExternalData.xml:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<ExternalData>
 <TString>EKX message example!</TString>  
 
 <Frames>
  <XFrame XPos="1.6" YPos="2.5" ZPos="3.4" ARot="4.3" BRot="5.2" CRot="6.1" />
 </Frames>
 <Frames>
  <XFrame XPos="13.1" YPos="24.5" ZPos="837.54" ARot="142.3" BRot="65.2" CRot="56.94" />  
 </Frames>
 <Boolean>
  <CState>0</CState>
 </Boolean>
</ExternalData>

und schließlich noch das Roboterprogramm(Fehlende Variablen-Deklarationen sind in der *.dat Datei!):

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
&ACCESS RVP
&REL 104
&PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe
&PARAM EDITMASK = *
DEF ekxdemo( )
;FOLD INI
  ;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
    ;Make your modifications here  ;ENDFOLD (USER INI)
;ENDFOLD (INI);FOLD Initial variables
brk = FALSE
counter = 0
cstate = FALSE
holdon = FALSE
seconds = 1
;ENDFOLD
;FOLD Build Dataset to receive
; receive structure
rectext[1].s[] = "SampleSensor.ExternalData.TString"
rectext[2].s[] = "SampleSensor.ExternalData.Frames.XFrame"
rectext[3].s[] = "SampleSensor.ExternalData.Frames.XFrame"
rectext[4].s[] = "SampleSensor.ExternalData.Boolean.CState"
rectext[5].s[] = "SampleSensor.ExternalData"
;ENDFOLD
;FOLD Declare sensorname and open channel SampleSensor
sensorname[]="SampleSensor"
errint = EKX_open(sensorname[])
EKX_handleerror(errint)
;ENDFOLD
WHILE cstate == FALSE
 
;FOLD Holdon
IF holdon == TRUE THEN
 HALT
ELSE
 WAIT SEC seconds
ENDIF
;ENDFOLD
;FOLD Get Data from stack, only if there are new values
errbl = EKX_WaitForSensorData(0, rectext[5].s[], 10000)
IF errbl == FALSE THEN
   HALT
ENDIF
; get string
bNew=STRCOPY(dummy[],rectext[1].s[])
errbl = EKX_GetStringElement(0, dummy[], bNew)
IF errbl == FALSE THEN
   HALT
ENDIF
; get frame until the stack is empty! FOR i=1 TO 2
    errbl = EKX_GetFrameElement( 0,  rectext[i+1].s[], extframe[i], bNew)
 IF errbl == FALSE THEN
    HALT
 ENDIF
ENDFOR
; get bool
errbl = EKX_GetBoolElement(0, rectext[4].s[], cstate, bNew)
IF errbl == FALSE THEN
   HALT
ENDIF
;ENDFOLD;FOLD Holdon
IF holdon == TRUE THEN
 HALT
ELSE
 WAIT SEC seconds
ENDIF
;ENDFOLD;FOLD PTP HOME  Vel= 100 % DEFAULT;%{PE}%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:100, 7:DEFAULT
    $BWDSTART = FALSE
    PDAT_ACT=PDEFAULT
    FDAT_ACT=FHOME
    BAS (#PTP_PARAMS,100 )
    $H_POS=XHOME
    PTP  XHOME
;ENDFOLD
    
PTP extframe[1]
PTP extframe[2];FOLD PTP HOME  Vel= 100 % DEFAULT;%{PE}%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:100, 7:DEFAULT
    $BWDSTART = FALSE
    PDAT_ACT=PDEFAULT
    FDAT_ACT=FHOME
    BAS (#PTP_PARAMS,100 )
    $H_POS=XHOME
    PTP  XHOME
;ENDFOLD
    ;FOLD At the end the channel have to be closed
errbl = EKX_close(sensorname[])
IF errbl == FALSE THEN
  HALT
ENDIF
;ENDFOLDEND

Ähnliche Themen