Probleme von EthernetKRLXML

  • Hallo zusammen,


    vielleicht erzähl ich erstmal um was es bei mir geht und wo ich im Moment grade steh:
    Bei uns am Lehrstuhl sollte der Robi über ein externes System zugriffen werden. Da butzen wir das EthernetKRLXML-Technologiepaket. Dann hab ich in c++ programmiert und beim Versuch, erstmals hab ich den xmlstring-Befehl <AR:RobotCommand><Gripper><Value>Close</Value></Gripper></AR:RobotCommand> an Roboter geschickt, und er hat auch richtig reagiert. Dann hab ich noch einen xmlstring-Befehl <AR:RobotCommand><Linear><Point XPos="-1900" YPos="-2000" ZPos="14" RX="0" RY="0" RZ="0"/></Linear></AR:RobotCommand> geschickt. Diesmal funktioniert nicht mehr. Ich wußte nicht, was passierte. :( Ich startete das embeded XP-system neu. Die Files AriktInt.src und AriktInt.dat wurden mit roten Kreuzen gekennzeichnet. Im Meldungsfenster gibt es solche Fehlermeldungen:


    i 2870 $Tool ungültig: keine Arbeitsraumüberwachung möglich
    ! KCP Objektbeschreibung nicht auswertbar
    ! 1421 /R1/ARIKTINT 44 Fehler bei Analyse


    Die Fehlerlist von dem File AriktInt.src sehen so aus:


    Zeile Spalte FehlerNr. Beschreibung
    161 6 2123 Name nicht als Funktion vereinbart
    162 1 2135 Name nicht als Funktion vereinbart
    164 6 2123 Name nicht als Funktion vereinbart
    253 6 2123 Name nicht als Funktion vereinbart
    265 6 2123 Name nicht als Funktion vereinbart
    277 6 2123 Name nicht als Funktion vereinbart
    289 6 2123 Name nicht als Funktion vereinbart
    ... ... ... ...


    Die betroffenen Namen sind die XMLAPI-Funktionsnamen wie z.b. xmlApiGetNextElementName().


    Ich weiss, dass das hier jetzt etwas länger geworden ist. Bin total genervt. :wallbash:
    Ich hab probiert, die Dateien wiederzustellen. Aba auch geht's nicht. :huh: Was soll und kann ich tun? :bawling:


    Vielen Dank für eure Antwort :hilfe:


    Simon

  • Schritt für Schritt zum Roboterprofi!
  • Entschuldigung, diesmal,


    -----------------------------------AriktInt.src----------------------------------------------------------
    &ACCESS RVEO
    &REL 151
    &PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe
    &PARAM EDITMASK = *
    DEF AriktInt()
    ; =============================================
    ; ***h* AriktInt/ArkitInt
    ; NAME
    ; AriktInt
    ; COPYRIGHT
    ; AMATEC Robotics GmbH (C) 2003
    ; FUNCTION
    ; This file is mainly designed to
    ; communicate with a vision system. The data
    ; exchange works on an endless XML String.
    ;
    ; The vision system send the parameters like
    ; <AR:RobotCommand>
    ; <PointToPoint>
    ; <Point XPos="110" YPos="0" ZPos="50"/>
    ; <Point XPos="80" YPos="10" ZPos="90"/>
    ; <Point XPos="290" YPos="0" ZPos="10"/>
    ; </PointToPoint>
    ; </AR:RobotCommand>
    ; The XML-Strings musst have the same
    ; spelling as the stacks in the file
    ; "AriktInt.xml" you can find in
    ; C:\KRC\Roboter\Init
    ;
    ; Actual working features of AriktInt:
    ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ; * PointToPoint-move
    ; - for a given point
    ; - for a given vector
    ; - continuous motion
    ; * Linear-move
    ; - for a given point
    ; - for a given vector
    ; - continuous motion
    ; * TCP-setting
    ; * Order of movements like in the
    ; XML- Document
    ; * Send a signal to server
    ; * Set velocity and acceleration
    ; - Lokal setting
    ; - Global setting
    ; * Set global continuous motion
    ;
    ; Further features to implement:
    ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ; * Circle-move
    ; - for a given point
    ; - for a given vector
    ; - continuous motion
    ; * Wait with the movements until the
    ; server sends a defined signal
    ;
    ; Data structure:
    ; TAG: This Structure consists of strings.
    ; In this strings you set the names
    ; of the stacks you want to read out
    ; from the buffer. There are only
    ; real elements you can read out from
    ; the buffer. You need the data types
    ; DATA and PKT to save the real
    ; elements.
    ; TAG consists of:
    ; CHAR cXPos[81]
    ; CHAR cYPos[81]
    ; CHAR cZPos[81]
    ; CHAR cRX[81]
    ; CHAR cRY[81]
    ; CHAR cRZ[81]
    ; CHAR cToleranceXYZ[81]
    ; CHAR cVelocity[81]
    ; CHAR cAcceleration[81]
    ; CHAR cAccuracy[81]
    ; DATA: This structure consists of
    ; Booleans and real values. Here you save
    ; the local and global settings in
    ; LIN- and CIRC-moves.
    ; DATA consists of:
    ; BOOL bVelNew
    ; BOOL bAccelNew
    ; BOOL bAccuNew
    ; REAL rVelocity
    ; REAL rAcceleration
    ; REAL rAccuracy
    ; PKT: This structure consists of a
    ; Boolean and a real to set the
    ; continuous motion for one movements.
    ; In the frame-element the new point
    ; is saved.
    ; PKT consists of:
    ; BOOL bToLNew ???
    ; REAL rTolerance
    ; FRAME fr
    ;
    ; CREATION DATE
    ; 03-06-01 Michael Baehr
    ; MODIFICATION HISTORY
    ; 03-06-11 Little Docu. update.
    ; Heinrich Mueller
    ; 03-06-12 Now with name space
    ; Heinrich Mueller
    ; 03-06-23 Send signal implemented
    ; Heinrich Mueller
    ; 03-06-24 Now movements in order
    ; Heinrich Mueller
    ; 03-09-01 Now set of velocity, acceleration
    ; and Coninuous motion in global
    ; and lokal settings
    ; Michael Baehr
    ; 03-09-10 "Override" Bug fixed
    ; Heinrich Mueller
    ; 03-09-17 "Missing Movement" Bug fixed
    ; and intriduced struc STRING
    ; Heinrich Mueller
    ; NOTES
    ; Doc needs some work
    ; BUGS
    ; 03-09-10 You need to send always X Y Z and
    ; XR YR ZR for LIN and PTP
    ; Heinrich Mueller
    ; 03-09-21 Program will fail after a while
    ; because of an error in the XML API
    ; (xmlApiGetNextElementName(..))
    ; Heinrich Mueller
    ; AUTHOR
    ; Michael Baehr
    ; (Heinrich Mueller)
    ; ***
    ; =============================================


    STRUC TAG ASTRING strXPos, ASTRING strYPos, ASTRING strZPos, ASTRING strRX, ASTRING strRY, ASTRING strRZ, ASTRING strToleranceXYZ, ASTRING strVelocity, ASTRING strAcceleration, ASTRING strAccuracy


    STRUC DATA BOOL bVelNew, BOOL bAccelNew, BOOL bAccuNew, REAL rVelocity, REAL rAcceleration, REAL rAccuracy


    STRUC PKT BOOL bTolNew, REAL rTolerance, FRAME fr


    BOOL bErr
    INT iErr
    DECL ASTRING strHostName
    ;FOLD INI;%{PE}%V3.2.0,%MKUKATPBASIS,%CINIT,%VCOMMON,%P
    ;FOLD BAS INI;%{E}%V3.2.0,%MKUKATPBASIS,%CINIT,%VINIT,%P
    GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
    INTERRUPT ON 3
    BAS (#INITMOV,0 )
    ;ENDFOLD (BAS INI)
    ;FOLD USER INI;%{E}%V3.2.0,%MKUKATPUSER,%CINIT,%VINIT,%P
    ;Make your modifications here
    ;ENDFOLD (USER INI)
    ;ENDFOLD (INI)





    ;FOLD PTP HOME Vel= 100 % DEFAULT;%{PE}%R 4.1.6,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:100, 7:DEFAULT
    $BWDSTART = FALSE
    PDAT_ACT=PDEFAULT
    BAS(#PTP_DAT)
    FDAT_ACT=FHOME
    BAS(#FRAMES)
    BAS(#VEL_PTP,100)
    $H_POS=XHOME
    PTP XHOME
    ;ENDFOLD
    strHostName.s[]="AriktInt"
    iErr=xmlApiOpen(strHostName )
    xmlApiHandleError(iErr)
    waitForData()
    bErr=xmlApiClose(strHostName )
    ;FOLD PTP HOME Vel= 100 % DEFAULT;%{PE}%V3.2.0,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:100, 7:DEFAULT
    $BWDSTART = FALSE
    $H_POS=XHOME
    PDAT_ACT=PDEFAULT
    BAS (#PTP_DAT )
    FDAT_ACT=FHOME
    BAS (#FRAMES )
    BAS (#VEL_PTP,100 )
    PTP XHOME
    ;ENDFOLD
    END


    ; =============================================
    ; ***f* AriktInt/waitForData
    ; NAME
    ; waitForData
    ; USAGE
    ; waitForData()
    ; DISCRIPTION
    ; Wait for NEW incoming data and call the
    ; right function.
    ; For PTP-Move: call getPTPFrame()
    ; For LIN-Move: call getLINFrames()
    ; For CIRC-Move: call getCIRCFrames()
    ; For TCP-setting: call setTool()
    ; PARAMETERS
    ; -
    ; RESULT
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF waitForData()


    INT iErr
    INT iIndex
    BOOL bErr
    BOOL bNew
    BOOL bEqual
    DECL ASTRING strEmpty
    DECL ASTRING strHostName
    DECL ASTRING strDocumentStartTag
    DECL ASTRING strPTPTag
    DECL ASTRING strLINTag
    DECL ASTRING strCIRCTag
    DECL ASTRING strTCPTag
    DECL ASTRING strVelocityTag
    DECL ASTRING strAccelerationTag
    DECL ASTRING strAccuracyTag
    DECL ASTRING strOutputSignalTag
    DECL ASTRING strNextTag
    DECL ASTRING strRealElementTag
    DECL ASTRING strPosActTag
    DECL ASTRING strGripperTag
    DECL PKT zPkt
    DECL PKT hPkt
    DECL DATA glData
    DECL DATA loData


    strEmpty.s[] = " "
    strHostName.s[] = "AriktInt"
    strDocumentStartTag.s[] = "AriktInt.AR:RobotCommand"
    strPTPTag.s[] = "AriktInt.AR:RobotCommand.PointToPoint"
    strLINTag.s[] = "AriktInt.AR:RobotCommand.Linear"
    strCIRCTag.s[] = "AriktInt.AR:RobotCommand.Cirstrle"
    strTCPTag.s[] = "AriktInt.AR:RobotCommand.TCP"
    strVelocityTag.s[] = "AriktInt.AR:RobotCommand.Velocity"
    strAccelerationTag.s[] = "AriktInt.AR:RobotCommand.Acceleration"
    strAccuracyTag.s[] = "AriktInt.AR:RobotCommand.Accuracy"
    strOutputSignalTag.s[] = "AriktInt.AR:RobotCommand.OutputSignal"
    strPosActTag.s[] = "AriktInt.AR:RobotCommand.PosAct"
    strGripperTag.s[] = "AriktInt.AR:RobotCommand.Gripper"
    strNextTag = strEmpty
    strRealElementTag = strEmpty



    dataInit(glData)


    LOOP
    bNew = false


    ; Is it a new document
    bEqual = strCmp(strNextTag, strDocumentStartTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strDocumentStartTag , bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    strNextTag=strEmpty
    ENDIF


    ; Is the next a PTP movement?
    bEqual = strCmp(strNextTag, strPTPTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strPTPTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    getPTPFrame(zPkt, glData, loData, strNextTag)
    ENDIF


    ; Is it a LIN movement?
    bEqual = strCmp(strNextTag, strLINTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strLINTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    getLINFrames(zPkt, glData, loData, strNextTag)
    ENDIF


    ; Is there a new TCP ?
    bEqual = strCmp(strNextTag, strTCPTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strTCPTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    setTool()
    strNextTag=strEmpty
    ENDIF


    ; Is there a new Velocity ?
    bEqual = strCmp(strNextTag, strVelocityTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strVelocityTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    strRealElementTag=strEmpty
    strRealElementTag.s[] = "AriktInt.AR:RobotCommand.Velocity.Nominal"
    readOutRealElement(strRealElementTag, glData.rVelocity, glData.bVelNew)
    glData.rVelocity = glData.rVelocity / 1000
    strNextTag=strEmpty
    ENDIF


    ; Is there a new Acceleration ?
    bEqual = strCmp(strNextTag, strAccelerationTag)
    IF bEqual == TRUE THEN
    bErr = xmlAPiGetStructElement(0, strAccelerationTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    strRealElementTag=strEmpty
    strRealElementTag.s[] = "AriktInt.AR:RobotCommand.Acceleration.Nominal"
    readOutRealElement(strRealElementTag, glData.rAcceleration, glData.bAccelNew)
    strNextTag=strEmpty
    ENDIF


    ; Is there a new Accuracy (Continuous Motion) ?
    bEqual = strCmp(strNextTag, strAccuracyTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strAccuracyTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    strRealElementTag=strEmpty
    strRealElementTag.s[] = "AriktInt.AR:RobotCommand.Accuracy.ToleranceXYZ"
    readOutRealElement(strRealElementTag, glData.rAccuracy, glData.bAccuNew)
    strNextTag=strEmpty
    ENDIF


    ;SELBST DEFINIERT 20060801 by DD
    ;Hier soll auf Abfragetags reagiert werden
    bEqual = strCmp(strNextTag, strPosActTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strPosActTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    sendPosAct()
    strNextTag=strEmpty
    ENDIF


    ;ENDE SELBST DEFINIERT 20060801 by DD
    ;SELBST DEFINIERT 20060802 by DD


    ; Greiferbefehl
    bEqual = strCmp(strNextTag, strGripperTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strGripperTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    setGripper()
    strNextTag=strEmpty


    ENDIF
    ;ENDE SELBST DEFINIERT 20060802 by DD


    ; OutputSignal ?
    bEqual = strCmp(strNextTag, strOutputSignalTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strOutputSignalTag, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    sendSignal()
    strNextTag=strEmpty


    ENDIF


    ; read new element name
    bEqual = strCmp(strNextTag, strEmpty)
    IF bEqual == TRUE THEN
    iErr = xmlApiGetNextElementName(strHostName, strNextTag)
    ENDIF


    ENDLOOP
    END


    ; =============================================
    ; ***f* AriktInt/getPTPFrame
    ; NAME
    ; getPTPFrame
    ; USAGE
    ; getPTPFrame(FrameZPkt, GlobalData, LokalData)
    ; DESCRIPTION
    ; Test if a new Point or vector is
    ; coming in and call the right function.
    ; For a new Point: call getNewPTPPoint()
    ; For a new Vector: call addNewPTPVector()
    ; PARAMETERS
    ; see header!
    ; DECL PKT zPkt:
    ; DECL DATA glData
    ; DECL DATA loData
    ; RESULT
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF getPTPFrame(zPkt:OUT, glData:OUT, loData:OUT, strNextTag:OUT)
    DECL PKT zPkt
    DECL DATA glData
    DECL DATA loData
    DECL ASTRING strNextTag


    INT iErr
    BOOL bErr
    BOOL bNew
    BOOL bEqual
    DECL ASTRING strPointTag
    DECL ASTRING strVectorTag
    DECL ASTRING strHostName


    strHostName.s[]="AriktInt"
    strPointTag.s[]="AriktInt.AR:RobotCommand.PointToPoint.Point"
    strVectorTag.s[]="AriktInt.AR:RobotCommand.PointToPoint.Vector"


    dataInit(loData)
    zPkt.rTolerance = 0
    zPkt.bTolNew = FALSE
    REPEAT
    iErr=xmlApiGetNextElementName(strHostName, strNextTag)
    bNew = FALSE


    ; Is the next a Point?
    bEqual=strCmp(strNextTag, strPointTag)
    IF bEqual==TRUE THEN
    bErr=xmlApiGetStructElement(0, strPointTag, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew==TRUE THEN
    getNewPTPPoint(zPkt)
    movePTP(zPkt, glData, loData)
    ENDIF
    ENDIF


    ;Or is it a Vector?
    bEqual=strCmp(strNextTag, strVectorTag)
    IF bEqual==TRUE THEN
    bErr=xmlApiGetStructElement(0, strVectorTag, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew==TRUE THEN
    addNewPTPVector(zPkt)
    movePTP(zPkt, glData, loData)
    ENDIF
    ENDIF


    UNTIL( bNew==FALSE )
    END


    ; =============================================
    ; ***f* AriktInt/getNewPTPPoint
    ; NAME
    ; getNewPTPPoint
    ; USAGE
    ; getNewPTPPoint(frameZPkt)
    ; DESCRIPTION
    ; Set Strings with the name of the stacks in
    ; the buffer. Then call readOutFrame() to get the
    ; frame from the buffer.
    ; PARAMETERS
    ; see header!
    ; DECL PKT zPkt
    ; RESULT
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF getNewPTPPoint(zPkt:OUT)
    DECL PKT zPkt


    DECL TAG tag
    BOOL bErr


    tag.strXPos.s[]="AriktInt.AR:RobotCommand.PointToPoint.Point.XPos"
    tag.strYPos.s[]="AriktInt.AR:RobotCommand.PointToPoint.Point.YPos"
    tag.strZPos.s[]="AriktInt.AR:RobotCommand.PointToPoint.Point.ZPos"
    tag.strRX.s[]="AriktInt.AR:RobotCommand.PointToPoint.Point.RX"
    tag.strRY.s[]="AriktInt.AR:RobotCommand.PointToPoint.Point.RY"
    tag.strRZ.s[]="AriktInt.AR:RobotCommand.PointToPoint.Point.RZ"
    tag.strToleranceXYZ.s[]="AriktInt.AR:RobotCommand.PointToPoint.Point.ToleranceXYZ"
    readOutFrame(zPkt, tag)


    zPkt.rTolerance = 0
    zPkt.bTolNew = FALSE
    bErr=xmlApiGetRealElement(0, tag.strToleranceXYZ, zPkt.rTolerance, zPkt.bTolNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF zPkt.bTolNew==TRUE THEN
    readNext(1)
    ENDIF
    END


    ; =============================================
    ; ***f* AriktInt/addNewPTPVector
    ; NAME
    ; addNewPTPVector
    ; USAGE
    ; addNewPTPVector(frameZPkt)
    ; DESCRIPTION
    ; Set Strings with the name of the stacks in
    ; the buffer. Then call readOutFrame() to get the
    ; vector from the buffer and call
    ; addVectorToActPos() to add the vector-
    ; Parameters to the actual position.
    ; PARAMETERS
    ; see header!
    ; DECL PKT zPkt
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF addNewPTPVector(zPkt:OUT)
    DECL PKT zPkt


    DECL PKT vector
    DECL TAG tag
    BOOL bErr


    tag.strXPos.s[]="AriktInt.AR:RobotCommand.PointToPoint.Vector.XPos"
    tag.strYPos.s[]="AriktInt.AR:RobotCommand.PointToPoint.Vector.YPos"
    tag.strZPos.s[]="AriktInt.AR:RobotCommand.PointToPoint.Vector.ZPos"
    tag.strRX.s[]="AriktInt.AR:RobotCommand.PointToPoint.Vector.RX"
    tag.strRY.s[]="AriktInt.AR:RobotCommand.PointToPoint.Vector.RY"
    tag.strRZ.s[]="AriktInt.AR:RobotCommand.PointToPoint.Vector.RZ"
    tag.strToleranceXYZ.s[]="AriktInt.AR:RobotCommand.PointToPoint.Vector.ToleranceXYZ"
    readOutFrame(vector, tag)


    vector.rTolerance = 0
    vector.bTolNew = FALSE
    bErr=xmlApiGetRealElement(0, tag.strToleranceXYZ, zPkt.rTolerance, zPkt.bTolNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF zPkt.bTolNew==TRUE THEN
    readNext(1)
    ENDIF
    addVectorToActPos(vector, zPkt)
    END


    ; =============================================
    ; ***f* AriktInt/movePTP
    ; NAME
    ; movePTP
    ; USAGE
    ; movePTP(frameZPkt, GlobalData, LokalData)
    ; DESCRIPTION
    ; Call getMoveTyp(). If the return is:
    ; 'eCONT_OFF' there will be no continuous
    ; motion.
    ; If the return is:'eCONT_ON' a
    ; tolerance-distance is set. And move to the
    ; given position.
    ; PARAMETERS
    ; see header!
    ; DECL PKT zPkt
    ; DECL DATA glData
    ; DECL DATA loData
    ; RESULT
    ; -
    ; NOTES
    ; - notes -
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF movePTP(zPkt:OUT, glData:OUT, loData:OUT)
    DECL PKT zPkt
    DECL DATA glData
    DECL DATA loData


    BOOL bErr
    INT choice


    choice = getMoveTyp(zPkt, glData, loData)
    setData(glData, loData)
    SWITCH choice
    CASE eCONT_OFF
    PTP zPkt.fr
    CASE eCONT_ON
    PTP zPkt.fr C_PTP
    DEFAULT
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDSWITCH
    END


    ; =============================================
    ; ***f* AriktInt/getLINFrames
    ; NAME
    ; getLINFrames
    ; USAGE
    ; getLINFrames(frameZPkt, GlobalData, LokalData)
    ; DESCRIPTION
    ; see getPTPFrame
    ; PARAMETERS
    ; see getPTPFrame
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; * Not all error return values are handled
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF getLINFrames(zPkt:OUT, glData:OUT, loData:OUT, strNextTag:OUT)
    DECL PKT zPkt
    DECL DATA glData
    DECL DATA loData
    DECL ASTRING strNextTag


    INT iErr
    BOOL bErr
    BOOL bNew
    BOOL bEqual
    DECL ASTRING strPointTag
    DECL ASTRING strVectorTag
    DECL ASTRING strHostName
    DECL ASTRING strVelocityTag
    DECL ASTRING strAccelerationTag
    DECL ASTRING strAccuracyTag
    DECL ASTRING strRealElementTag


    strHostName.s[] = "AriktInt"
    strPointTag.s[] = "AriktInt.AR:RobotCommand.Linear.Point"
    strVectorTag.s[] = "AriktInt.AR:RobotCommand.Linear.Vector"
    strVelocityTag.s[] = "AriktInt.AR:RobotCommand.Linear.Velocity"
    strAccelerationTag.s[] = "AriktInt.AR:RobotCommand.Linear.Acceleration"
    strAccuracyTag.s[] = "AriktInt.AR:RobotCommand.Linear.Accuracy"
    strRealElementTag.s[] = " "
    ;strNextTag[]=" "


    dataInit(loData)
    REPEAT
    iErr=xmlApiGetNextElementName(strHostName, strNextTag)
    bNew=false


    ; Is the next a Point?
    bEqual=strCmp(strNextTag, strPointTag)
    IF bEqual==TRUE THEN
    bErr=xmlApiGetStructElement(0, strPointTag, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew==TRUE THEN
    getNewLINPoint(zPkt)
    moveLIN(zPkt, glData, loData)
    ENDIF
    ENDIF


    ;Or is it a Vector?
    bEqual=strCmp(strNextTag, strVectorTag)
    IF bEqual==TRUE THEN
    bErr=xmlApiGetStructElement(0, strVectorTag, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew==TRUE THEN
    addNewLINVector(zPkt)
    moveLIN(zPkt, glData, loData)
    ENDIF
    ENDIF


    ; Is there a new Velocity ?
    bEqual = strCmp(strNextTag, strVelocityTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strVelocityTag, bNew)
    IF bErr == FALSE THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    strRealElementTag.s[] = "AriktInt.AR:RobotCommand.Linear.Velocity.Nominal"
    readOutRealElement(strRealElementTag, loData.rVelocity, loData.bVelNew)
    loData.rVelocity = loData.rVelocity / 1000
    ENDIF
    ENDIF


    ; Is there a new Acceleration ?
    bEqual = strCmp(strNextTag, strAccelerationTag)
    IF bEqual == TRUE THEN
    bErr = xmlAPiGetStructElement(0, strAccelerationTag, bNew)
    IF bErr == FALSE THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    strRealElementTag.s[] = "AriktInt.AR:RobotCommand.Linear.Acceleration.Nominal"
    readOutRealElement(strRealElementTag, loData.rAcceleration, loData.bAccelNew)
    loData.bAccelNew = TRUE
    ENDIF
    ENDIF


    ; Is there a new Accuracy (Continuous Motion) ?
    bEqual = strCmp(strNextTag, strAccuracyTag)
    IF bEqual == TRUE THEN
    bErr = xmlApiGetStructElement(0, strAccuracyTag, bNew)
    IF bErr == FALSE THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    strRealElementTag.s[] = "AriktInt.AR:RobotCommand.Linear.Accuracy.ToleranceXYZ"
    readOutRealElement(strRealElementTag, loData.rAccuracy, loData.bAccuNew)
    loData.bAccuNew = TRUE
    ENDIF
    ENDIF


    UNTIL( bNew==FALSE )
    END


    ; =============================================
    ; ***f* AriktInt/getNewLINPoint
    ; NAME
    ; getNewLINPoint
    ; USAGE
    ; getNewLINPoint(frameZPkt)
    ; DESCRIPTION
    ; see getNewPTPPoint
    ; PARAMETERS
    ; see getNewPTPPoint
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF getNewLINPoint(zPkt:OUT)
    DECL PKT zPkt


    DECL TAG tag
    BOOL bErr


    tag.strXPos.s[]="AriktInt.AR:RobotCommand.Linear.Point.XPos"
    tag.strYPos.s[]="AriktInt.AR:RobotCommand.Linear.Point.YPos"
    tag.strZPos.s[]="AriktInt.AR:RobotCommand.Linear.Point.ZPos"
    tag.strRX.s[]="AriktInt.AR:RobotCommand.Linear.Point.RX"
    tag.strRY.s[]="AriktInt.AR:RobotCommand.Linear.Point.RY"
    tag.strRZ.s[]="AriktInt.AR:RobotCommand.Linear.Point.RZ"
    tag.strToleranceXYZ.s[]="AriktInt.AR:RobotCommand.Linear.Point.ToleranceXYZ"
    readOutFrame(zPkt, tag)


    zPkt.rTolerance = 0
    zPkt.bTolNew = FALSE
    bErr=xmlApiGetRealElement(0, tag.strToleranceXYZ, zPkt.rTolerance, zPkt.bTolNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF zPkt.bTolNew==TRUE THEN
    readNext(1)
    ENDIF
    END


    ; =============================================
    ; ***f* AriktInt/addNewLINVector
    ; NAME
    ; addNewLINVector
    ; USAGE
    ; addNewLINVector(frameZPkt)
    ; DESCRIPTION
    ; see addNewPTPVector
    ; PARAMETERS
    ; see addNewPTPVector
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF addNewLINVector(zPkt:OUT)
    DECL PKT zPkt


    DECL PKT vector
    DECL TAG tag
    BOOL bErr


    tag.strXPos.s[]="AriktInt.AR:RobotCommand.Linear.Vector.XPos"
    tag.strYPos.s[]="AriktInt.AR:RobotCommand.Linear.Vector.YPos"
    tag.strZPos.s[]="AriktInt.AR:RobotCommand.Linear.Vector.ZPos"
    tag.strRX.s[]="AriktInt.AR:RobotCommand.Linear.Vector.RX"
    tag.strRY.s[]="AriktInt.AR:RobotCommand.Linear.Vector.RY"
    tag.strRZ.s[]="AriktInt.AR:RobotCommand.Linear.Vector.RZ"
    tag.strToleranceXYZ.s[]="AriktInt.AR:RobotCommand.Linear.Vector.ToleranceXYZ"
    readOutFrame(vector, tag)


    vector.rTolerance = 0
    vector.bTolNew = FALSE
    bErr=xmlApiGetRealElement(0, tag.strToleranceXYZ, zPkt.rTolerance, zPkt.bTolNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF zPkt.bTolNew==TRUE THEN
    readNext(1)
    ENDIF
    addVectorToActPos(vector, zPkt)
    END


    ; =============================================
    ; ***f* AriktInt/moveLIN
    ; NAME
    ; moveLIN
    ; USAGE
    ; moveLIN(frameZPkt, GlobalData, LokalData)
    ; DESCRIPTION
    ; see movePTP
    ; PARAMETERS
    ; see movePTP
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF moveLIN(zPkt, glData, loData)
    DECL PKT zPkt
    DECL DATA glData
    DECL DATA loData
    BOOL bErr
    INT choice


    choice = getMoveTyp(zPkt, glData, loData)
    setData(glData, loData)
    SWITCH choice
    CASE eCONT_OFF
    LIN zPkt.fr
    CASE eCONT_ON
    LIN zPkt.fr C_DIS
    DEFAULT
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDSWITCH
    END


    ; =============================================
    ; ***f* AriktInt/getCIRCFrames
    ; NAME
    ; getCIRCFrames
    ; USAGE
    ; getCIRCFrames(frameZPkt, frameHPkt,
    ; GlobalData, LokalData)
    ; DISCRIPTION
    ; see getPTPFrame
    ; PARAMETERS
    ; see getPTPFrame
    ; RESULT
    ; -
    ; NOTES
    ; not finished!!!
    ; BUGS
    ; * Not all error return values are handled
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF getCIRCFrames(zPkt:OUT, hPkt:OUT, glData:OUT, loData:OUT)
    DECL PKT zPkt
    DECL PKT hPkt
    DECL DATA glData
    DECL DATA loData


    BOOL bErr
    BOOL bNewPoint
    BOOL bNewVector
    DECL ASTRING strPointTag
    DECL ASTRING strVectorTag


    strPointTag.s[]="AriktInt.AR:RobotCommand.Circle.Point"
    strVectorTag.s[]="AriktInt.AR:RobotCommand.Circle.Vector"


    REPEAT
    ;Is it a Point?
    bErr=xmlApiGetStructElement(0, strPointTag, bNewPoint)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNewPoint==TRUE THEN
    getNewLINPoint(zPkt)
    ENDIF


    ;Is it a Vector?
    bErr=xmlApiGetStructElement(0, strVectorTag, bNewVector)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNewVector==TRUE THEN
    addNewLINVector(zPkt)
    ENDIF


    ; Do the movement
    IF (bNewPoint==TRUE)OR(bNewVector==TRUE) THEN
    moveLIN(zPkt, glData, loData)
    ENDIF
    UNTIL( (bNewPoint==FALSE)AND(bNewVector==FALSE) )


    END
    ; =============================================
    ; ***f* AriktInt/getNewCIRCPoint
    ; NAME
    ; getNewCIRCPoint
    ; USAGE
    ; getNewCIRCPoint(frameZPkt)
    ; DESCRIPTION
    ; see getNewPTPPoint()
    ; PARAMETERS
    ; see getNewPTPPoint
    ; RESULT
    ; -
    ; Notes
    ; not finished!!!
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF getNewCIRCPoint(pkt:OUT)
    DECL PKT pkt


    END


    ; =============================================
    ; ***f* AriktInt/addNewCIRCVector
    ; NAME
    ; addNewCIRCVector
    ; USAGE
    ; addNewCIRCVector(frameZPkt)
    ; DESCRIPTION
    ; see addNewPTPVector()
    ; PARAMETERS
    ; see addNewPTPVector()
    ; RESULT
    ; -
    ; Notes
    ; not finished!!!
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF addNewCIRCVector(pkt:OUT)
    DECL PKT pkt


    END


    ; =============================================
    ; ***f* AriktInt/setTool
    ; NAME
    ; setTool
    ; USAGE
    ; setTool()
    ; DESCRIPTION
    ; Set Strings with the name of the stacks in
    ; the buffer. Then call readOutFrame() to get the
    ; Frame from the buffer and set the new Tool
    ; PARAMETERS
    ; - none -
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF setTool()


    DECL PKT newTool
    DECL TAG tag


    tag.strXPos.s[]="AriktInt.AR:RobotCommand.TCP.Vector.XPos"
    tag.strYPos.s[]="AriktInt.AR:RobotCommand.TCP.Vector.YPos"
    tag.strZPos.s[]="AriktInt.AR:RobotCommand.TCP.Vector.ZPos"
    tag.strRX.s[]="AriktInt.AR:RobotCommand.TCP.Vector.RX"
    tag.strRY.s[]="AriktInt.AR:RobotCommand.TCP.Vector.RY"
    tag.strRZ.s[]="AriktInt.AR:RobotCommand.TCP.Vector.RZ"


    readOutFrame(newTool, tag)
    $tool=newTool.fr
    END


    ; =============================================
    ; ***f* AriktInt/readOutRealElement
    ; NAME
    ; readOutRealElement
    ; USAGE
    ; readOutRealElement(cRealElemtnTag[],
    ; rElement, bNew)
    ; DESCRIPTION
    ; Read out a real element from the buffer and
    ; save it under rElement. The String for the
    ; right stack is given with strRealElementTag[]
    ; PARAMETERS
    ;
    ; BOOL bErr
    ; BOOL bNew
    ; REAL rElement
    ; CHAR strRealElementTag[]
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; -
    ; AUTHOR
    ; Michael Baehr


    DEF readOutRealElement(strRealElementTag:OUT, rElement:OUT, bNew:OUT)
    BOOL bNew
    REAL rElement
    DECL ASTRING strRealElementTag


    BOOL bErr


    bErr = xmlApiGetRealElement(0, strRealElementTag, rElement, bNew)
    IF bErr == FALSE THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    readNext(1)
    ENDIF
    END


    ; =============================================
    ; ***f* AriktInt/readOutFrame
    ; NAME
    ; readOutFrame
    ; USAGE
    ; readOutFrame(frameZPkt, )
    ; DESCRIPTION
    ; Read out real and boolean elements from the
    ; buffer und save them under Frame and
    ; rTolerance. The Strings for the right
    ; stacks are given with tag e.g. tag.strXPos.s[]
    ; or tag.strToleranceXYZ.s[].
    ; PARAMETERS
    ; see header!
    ; DECL PKT new
    ; DECL TAG tag
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; * bNew need to be tested on plausibility
    ; * Consider here a KRL FRAME instead of a
    ; own structure
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF readOutFrame(new:OUT, tag:OUT)
    DECL PKT new
    DECL TAG tag


    BOOL bErr
    BOOL bNew


    bErr=xmlApiGetRealElement(0, tag.strXPos, new.fr.x, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    readNext(1)
    ENDIF


    bErr=xmlApiGetRealElement(0, tag.strYPos, new.fr.y, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    readNext(1)
    ENDIF


    bErr=xmlApiGetRealElement(0, tag.strZPos, new.fr.z, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    readNext(1)
    ENDIF


    bErr=xmlApiGetRealElement(0, tag.strRX, new.fr.a, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    readNext(1)
    ENDIF


    bErr=xmlApiGetRealElement(0, tag.strRY, new.fr.b, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    readNext(1)
    ENDIF


    bErr=xmlApiGetRealElement(0, tag.strRZ, new.fr.c, bNew)
    IF bErr==FALSE THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    IF bNew == TRUE THEN
    readNext(1)
    ENDIF


    END


    ; =============================================
    ; ***f* AriktInt/addVectorToActPos
    ; NAME
    ; addVectorToActPos
    ; USAGE
    ; addVectorToActPos(vector, frameZPkt)
    ; DESCRIPTION
    ; Add a new vector from the buffer to actual
    ; position of the robot. Only X, Y and Z
    ; must be added because A, B and C are
    ; angles.
    ; PARAMETERS
    ; see header!
    ; DECL PKT zPkt: The vector will be added to
    ; this frame
    ; DECL PKT vector
    ; RESULT
    ; -
    ; NOTES
    ; - none -
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF addVectorToActPos(vector:IN, zPkt:OUT)
    DECL PKT zPkt
    DECL PKT vector


    zPkt.fr.x=vector.fr.x + $pos_act.x
    zPkt.fr.y=vector.fr.y + $pos_act.y
    zPkt.fr.z=vector.fr.z + $pos_act.z
    zPkt.fr.a=vector.fr.a
    zPkt.fr.b=vector.fr.b
    zPkt.fr.c=vector.fr.c
    zPkt.rTolerance=vector.rTolerance
    zPkt.bTolNew=vector.bTolNew
    END


    ; =============================================
    ; ***f* AriktInt/setData
    ; NAME
    ; setData
    ; USAGE
    ; setData(GlobalData, LokalData)
    ; DESCRIPTION
    ; Test data an set the right acceleration
    ; and velocity
    ; PARAMETERS
    ; see header!
    ; DECL PKT zPkt
    ; DECL DATA glData
    ; DECL DATA loData
    ; RESULT
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF setData(glData, loData)
    DECL DATA glData
    DECL DATA loData


    REAL rVelocity
    REAL rAcceleration


    rVelocity = 0
    rAcceleration = 0
    IF glData.rVelocity <> 0 THEN
    rVelocity = glData.rVelocity
    ENDIF
    IF loData.rVelocity <> 0 THEN
    rVelocity = loData.rVelocity
    ENDIF
    IF rVelocity <> 0 THEN
    $VEL.CP = rVelocity
    ENDIF


    IF glData.rAcceleration <> 0 THEN
    rAcceleration = glData.rAcceleration
    ENDIF
    IF loData.rAcceleration <> 0 THEN
    rAcceleration = loData.rAcceleration
    ENDIF
    IF rAcceleration <> 0 THEN
    $ACC.CP = rAcceleration
    ENDIF


    END


    ; =============================================
    ; ***f* AriktInt/getMoveTyp
    ; NAME
    ; getMoveTyp
    ; USAGE
    ; getMoveTyp(frameZPkt, choice)
    ; DESCRIPTION
    ; Test if a tolerance distance is given or
    ; not. For a given tolerance distance the
    ; overlap-setting is on (choice = eCONT_ON)
    ; and if the tolerance distance is not given
    ; the overlap-setting is off (choice =
    ; eCONT_OFF).
    ; PARAMETERS
    ; see header!
    ; DECL PKT zPkt
    ; RESULT
    ; INT choice:
    ; eCONT_OFF :tolerance distance is
    ; NOT given
    ; eCONT_ON :tolerance distance is
    ; given
    ; NOTES
    ; - none -
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEFFCT INT getMoveTyp(zPkt, glData, loData)
    DECL PKT zPkt
    DECL DATA glData
    DECL DATA loData


    REAL rTolerance


    rTolerance = 0
    IF glData.rAccuracy <> 0 THEN
    rTolerance = glData.rAccuracy
    ENDIF
    IF loData.rAccuracy <> 0 THEN
    rTolerance = loData.rAccuracy
    ENDIF
    IF zPkt.bTolNew == TRUE THEN
    IF zPkt.rTolerance <> 0 THEN
    rTolerance = zPkt.rTolerance
    ENDIF
    ENDIF
    IF rTolerance <> 0 THEN
    $APO.CDIS = rTolerance
    RETURN eCONT_ON
    ELSE
    RETURN eCONT_OFF
    ENDIF
    ENDFCT


    ; =============================================
    ; ***f* AriktInt/tagInit
    ; NAME
    ; tagInit
    ; USAGE
    ; tagInit(tag)
    ; DESCRIPTION
    ; Clear all Strings in tag!!!
    ; PARAMETERS
    ; see header!
    ; DECL TAG tag
    ; RESULT
    ; -
    ; NOTES
    ; Not finished!!!
    ; BUGS
    ; In that way there is no function!!!
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF tagInit(tag:OUT)
    DECL TAG tag


    tag.strXPos.s[]=" "
    tag.strYPos.s[]=" "
    tag.strZPos.s[]=" "
    tag.strRX.s[]=" "
    tag.strRY.s[]=" "
    tag.strRZ.s[]=" "
    tag.strToleranceXYZ.s[]=" "
    tag.strVelocity.s[]=" "
    tag.strAcceleration.s[]=" "
    tag.strAccuracy.s[]=" "
    END


    ; =============================================
    ; ***f* AriktInt/dataInit
    ; NAME
    ; dataInit


    ; USAGE
    ; dataInit(data)
    ; DESCRIPTION
    ; set all REAL in data= 0 and all BOOL in
    ; data= FALSE
    ; PARAMETERS
    ; DECL DATA data
    ; RESULT
    ; -
    ; NOTES
    ; not in use!!!
    ; BUGS
    ; - none -
    ; AUTHOR
    ; Michael Baehr
    ; ***
    DEF dataInit(data:OUT)
    DECL DATA data


    data.rVelocity=0
    data.rAcceleration=0
    data.rAccuracy=0
    data.bVelNew=FALSE
    data.bAccelNew=FALSE
    data.bAccuNew=FALSE
    END


    ; =============================================
    ; ***f* AriktInt/sendSignal
    ; NAME
    ; sendSignal
    ; USAGE
    ; -
    ; DESCRIPTION
    ; This part send a signal back to the server
    ; if a defined position is reached.
    ; PARAMETERS
    ; -
    ; RESULT
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; -
    ; AUTHOR
    ; Heinrich Mueller
    ; ***
    DEF sendSignal()


    INT iErr
    BOOL bErr
    BOOL bNew
    DECL ASTRING strHostName
    DECL ASTRING strSignal
    DECL ASTRING strSignalOut
    DECL STATE_T state
    INT iIndex


    strHostName.s[]="AriktInt"
    strSignal.s[]="AriktInt.AR:RobotCommand.OutputSignal.Value"
    strSignalOut.s[]=" "
    iIndex=0


    bErr=xmlApiGetStringElement(0, strSignal, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    readNext(1)


    CONTINUE
    SWRITE(strSignalOut.s[], state, iIndex, "<Signal Value=~")
    IF state.RET1<>#CMD_OK THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    CONTINUE
    SWRITE(strSignalOut.s[], state, iIndex, strSignal.s[])
    IF state.RET1<>#CMD_OK THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    CONTINUE
    SWRITE(strSignalOut.s[], state, iIndex, "~/>")
    IF state.RET1<>#CMD_OK THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF


    WAIT SEC 0.0 ; Here we do need a advance stop
    iErr=xmlApiWriteLine(strHostName, strSignalOut)
    IF iErr==eIOC_ERROR THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    END


    ; =============================================
    ; =============================================
    ; ***f* AriktInt/sendPosAct
    ; NAME
    ; sendPosAct
    ; USAGE
    ; -
    ; DESCRIPTION
    ; Diese Prozedur schickt die aktuelle Position an den Server
    ; PARAMETERS
    ; -
    ; RESULT
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; -
    ; AUTHOR
    ; D. Dötz
    ; ***
    DEF sendPosAct()


    INT iErr
    BOOL bErr
    BOOL bNew
    DECL ASTRING strHostName
    DECL ASTRING strPosAct
    DECL ASTRING strPosActOut1
    DECL ASTRING strPosActOut2
    DECL ASTRING strPosActOut3
    DECL STATE_T state
    INT iIndex


    strHostName.s[]="AriktInt"
    strPosAct.s[]="AriktInt.AR:RobotCommand.PosAct.Value"
    strPosActOut1.s[]=" "
    strPosActOut2.s[]=" "
    strPosActOut3.s[]=" "
    iIndex=0
    bErr=xmlApiGetStringElement(0, strPosAct, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    readNext(1)
    ;Die Positionsdaten werden in drei Pakete aufgeteilt, weil
    ;die MTU (Maximum Transmission Unit) eines xmlApiWrite-Befehls
    ;bei 80 Zeichen liegt.
    ;1. Paket (CONTINUE steht um den Vorlaufzeigerstop des
    ;SWRITE-Befehls aufzuheben


    CONTINUE
    SWRITE(strPosActOut1.s[], state, iIndex,"<Point XPos=~%e~ YPos=~%e~ ", $POS_ACT.X, $POS_ACT.Y)
    IF state.RET1<>#CMD_OK THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF


    ;WAIT SEC 0.0 Den Advance Stop mach ich bewusst mal raus
    iErr=xmlApiWrite(strHostName, strPosActOut1)
    IF iErr==eIOC_ERROR THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    ;2. Paket - Zuvor noch den Pufferzeiger resetten

    iIndex=0
    CONTINUE
    SWRITE(strPosActOut2.s[], state, iIndex,"ZPos=~%e~ RX=~%e~ ", $POS_ACT.Z, $POS_ACT.A)
    IF state.RET1<>#CMD_OK THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF


    ;WAIT SEC 0.0 Den Advance Stop mach ich bewusst mal raus
    iErr=xmlApiWrite(strHostName, strPosActOut2)
    IF iErr==eIOC_ERROR THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    ;3. Paket - zuvor noch den Pufferzeiger resetten

    iIndex=0
    CONTINUE
    SWRITE(strPosActOut3.s[], state, iIndex,"RY=~%e~ RZ=~%e~/>", $POS_ACT.B, $POS_ACT.C)
    IF state.RET1<>#CMD_OK THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF


    ;WAIT SEC 0.0 Den Advance Stop mach ich bewusst mal raus
    iErr=xmlApiWriteLine(strHostName, strPosActOut3)
    IF iErr==eIOC_ERROR THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF
    END
    ; =============================================


    ; =============================================
    ; ***f* AriktInt/setGripper
    ; NAME
    ; setGripper
    ; USAGE
    ; -
    ; DESCRIPTION
    ; In Abhaengigkeit vom Wert des Elements Value wird der
    ; Greifer geoeffnet ("Open") bzw. geschlossen ("Close")
    ; PARAMETERS
    ; -
    ; RESULT
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; -
    ; AUTHOR
    ; D. Doetz
    ; ***
    DEF setGripper()


    INT iErr
    BOOL bErr
    BOOL bNew
    DECL ASTRING strHostName
    DECL ASTRING strGripper
    DECL ASTRING strGripperOpen
    DECL ASTRING strGripperClose


    strHostName.s[]="AriktInt"
    strGripperOpen.s[]="Open"
    strGripperClose.s[]="Close"
    strGripper.s[]="AriktInt.AR:RobotCommand.Gripper.Value"


    bErr=xmlApiGetStringElement(0, strGripper, bNew)
    IF (bErr==FALSE)OR(bNew==FALSE) THEN
    error(bErr, eOutPrintQuitt)
    HALT
    error(bErr, eOutPrintStop)
    ENDIF
    readNext(1)
    WAIT SEC 0.0 ; Vorlaufzeiger stoppen
    IF strCmp(strGripper,strGripperOpen) THEN


    ;FOLD SET GRP 1 State= OPN GDAT1;%{PE}%R 6.0.4,%MKUKATPGRP,%CGRP,%VGRP,%P 2:1, 4:1, 5:#NO, 6:GDAT1, 8:0, 10:0
    H50(GRP,1,1,GGDAT1)
    ;ENDFOLD
    ENDIF


    IF strCmp(strGripper,strGripperClose) THEN


    ;FOLD SET GRP 1 State= CLO GDAT2;%{PE}%R 6.0.4,%MKUKATPGRP,%CGRP,%VGRP,%P 2:1, 4:2, 5:#NO, 6:GDAT2, 8:0, 10:0
    H50(GRP,1,2,GGDAT2)
    ;ENDFOLD
    ENDIF


    END





    ; =============================================
    ; ***f* AriktInt/error
    ; NAME
    ; error
    ; USAGE
    ; error(bErr)
    ; DESCRIPTION
    ; Test if there is an error. if bErr=FALSE
    ; then the function print out:"SERIOUS ERROR!
    ; STOP AND RESET!" and stop system.
    ; PARAMETERS
    ; BOOL bErr:
    ; FALSE=error
    ; TRUE=NO error
    ; INT chooseOutPrint
    ; eOutPrintQuitt="SERIOUS ERROR!"
    ; eOUTPrintStop="STOP AND RESET!!!"
    ; RESULT
    ; -
    ; NOTES
    ; This programm tells you where the error is.
    ; BUGS
    ; AUTHOR
    ; Michael Baehr
    ; Heinrich Mueller
    ; ***
    DEF error(bErr:IN,chooseOutPrint:IN)
    BOOL bErr
    INT chooseOutPrint


    DECL MSG_T msgError


    msgError={MSG_T: VALID FALSE,RELEASE FALSE,TYP #QUIT,MODUL[] "AriktInt",KEY[] "-",PARAM_TYP #VALUE,PARAM[] " ",DLG_FORMAT[] " ",ANSWER 0}
    $msg_t=msgError


    SWITCH chooseOutPrint
    CASE eOutPrintQuitt
    $msg_t.key[] = "SERIOUS ERROR"
    $msg_t.valid=TRUE


    CASE eOutPrintStop
    LOOP
    $msg_t.key[] = "STOP AND RESET!"
    $msg_t.valid=TRUE
    ENDLOOP


    DEFAULT
    LOOP
    $msg_t.key[] = "Unkown_error! STOP AND RESET!"
    ENDLOOP
    ENDSWITCH
    END


    ; =============================================
    ; ***f* AriktInt/readNext
    ; NAME
    ; -
    ; USAGE
    ; -
    ; DESCRIPTION
    ; -
    ; PARAMETERS
    ; -
    ; RESULT
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; -
    ; AUTHOR
    ; Heinrich Mueller
    ; ***
    DEF readNext(iNr:IN)
    INT iNr


    INT iIndex
    INT iErr
    DECL ASTRING strNextTag
    DECL ASTRING strHostName


    strNextTag.s[]=" "
    strHostName.s[]="AriktInt"


    FOR iIndex=1 TO iNr
    iErr=xmlApiGetNextElementName(strHostName, strNextTag)
    IF iErr<>0 THEN
    ;error(bErr,eOutPrintQuitt)
    ;HALT
    ;error(bErr,eOutPrintStop)
    ENDIF
    ENDFOR
    END


    ; =============================================
    ; ***f* AriktInt/strCmp
    ; NAME
    ; -
    ; USAGE
    ; -
    ; DESCRIPTION
    ; Compare 2 strings
    ; PARAMETERS
    ; -
    ; RESULT
    ; true if strings are equal
    ; NOTES
    ; -
    ; BUGS
    ; -
    ; AUTHOR
    ; Heinrich Mueller
    ; ***
    GLOBAL DEFFCT BOOL strCmp(str1:OUT, str2:OUT)
    DECL ASTRING str1
    DECL ASTRING str2


    BOOL bErr
    INT iLength1, iLength2, iIndex
    DECL STATE_T state
    DECL ASTRING strDummy


    iLength1=0
    iLength2=0


    ; get length of string 1
    CONTINUE
    SWRITE(strDummy.s[], state, iLength1, "%s", str1.s[])












    IF state.RET1<>#CMD_OK THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF


    ; get length of string 2
    CONTINUE
    SWRITE(strDummy.s[], state, iLength2, "%s", str2.s[])
    IF state.RET1<>#CMD_OK THEN
    error(bErr,eOutPrintQuitt)
    HALT
    error(bErr,eOutPrintStop)
    ENDIF


    IF( iLength1<>iLength2) THEN
    RETURN FALSE
    ENDIF


    FOR iIndex=1 TO iLength1
    IF( str1.s[iIndex]<>str2.s[iIndex] ) THEN
    RETURN FALSE
    ENDIF
    ENDFOR
    RETURN TRUE
    ENDFCT



    -----------------------------------------------------------------------------------------------------------------------------------------------------------------AriktInt.Dat--------------------------------------------
    &ACCESS RVEO
    &REL 151
    &PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe

  • ---------------------------------------------------AriktInt.Dat---------------------------------------------
    &ACCESS RVEO
    &REL 151
    &PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe
    &PARAM EDITMASK = *
    DEFDAT ARIKTINT


    ;FOLD EXTERNAL DECLARATIONS;%{PE}%V3.2.0,%MKUKATPBASIS,%CEXT,%VCOMMON,%P
    ;FOLD BAS EXT;%{PE}%V3.2.0,%MKUKATPBASIS,%CEXT,%VEXT,%P
    EXT BAS (BAS_COMMAND :IN,REAL :IN )
    DECL INT SUCCESS
    ;ENDFOLD
    ;FOLD USER EXT;%{E}%V3.2.0,%MKUKATPUSER,%CEXT,%VEXT,%P
    ;Make here your modifications
    ;ENDFOLD
    ;ENDFOLD


    ; =============================================
    ; ***h* AriktInt/ArkitInt
    ; NAME
    ; AriktInt
    ; COPYRIGHT
    ; AMATEC Robotics GmbH (C) 2003
    ; FUNCTION
    ; pseudo enumeration to indicate
    ; continuous motion
    ; CREATION DATE
    ; 03-06-01 Michael Baehr
    ; MODIFICATION HISTORY
    ; -
    ; NOTES
    ; -
    ; BUGS
    ; -
    ;
    ; AUTHOR
    ; Michael Baehr, Heinrich Mueller
    ; ***
    CONST INT eCONT_OFF=1
    CONST INT eCONT_ON=2


    CONST INT eOutPrintQuitt=1
    CONST INT eOutPrintStop=2



    DECL BASIS_SUGG_T LAST_BASIS={POINT1[] "P0 ",POINT2[] "P0 ",CP_PARAMS[] "CPDAT0 ",PTP_PARAMS[] "PDAT0 ",CONT[] " ",CP_VEL[] "2.0 ",PTP_VEL[] " 100 "}
    DECL GRP_SUGG_T LAST_GRP={NUMBER[] "1 ",STATE[] "2 ",PARAMS[] "GDAT2 "}
    DECL GRP_TYP GGDAT1={G_APO #NO,TIME 0.200000003,CTRL #OFF,DLY 0,DST 1}
    DECL GRP_TYP GGDAT2={G_APO #NO,TIME 0.200000003,CTRL #OFF,DLY 0,DST 1}
    ENDDAT


    ---------------

  • Hi YangYang


    1.: Mir scheint, daß das TP KRLXML irgendwie zerschossen ist. Installier das mal neu.


    2.: Eine Bewegung zu starten über KRLXML ist schon eine mutige Sache. Aber bevor Du das Kommando gibst zur Ausführung einer Bewegung mußt Du unbedingt das Tool initialisieren.


    Welchen XML-Parser verwendest Du c++ - seitig? Auf der Installations-CD von KRLXML ist ein Muster drauf. Vielleicht schaust mal rein.


    Gruß Robodoc

    Weniger als 100% wird nicht akzeptiert :)

  • Hi robodoc,


    Vielen Dank!
    Ich werde mal probieren mal neu zu installieren. Von der c++-Seite gibt es noch keinen XML-Parser. Die Überwachung vom Roboter wurde durch serielle Verbindung realisiert. Ich sendete nur XML-Strings zu.


    Gruß
    Simon

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now