您现在所在的是:

机器人论坛

回帖:18个,阅读:14128 [上一页] [1] [2] [下一页]
446
740249982
文章数:8
年度积分:50
历史总积分:446
注册时间:2016/11/29
发站内信
发表于:2016/11/29 15:21:05
#0楼

先进入KRC,然后R1,有个Program,里面的promain_0510.src。。。。希望高手们能中文帮我翻译下
20分悬赏
446
740249982
文章数:8
年度积分:50
历史总积分:446
注册时间:2016/11/29
发站内信
发表于:2016/11/29 15:22:14
#1楼
DEF promain_0510( )
;FOLD INI
 ;FOLD BASISTECH INI
   BAS (#INITMOV,0 )
   INTERRUPT DECL 128 WHEN $flag[2]==true DO BufferRecData ( )
 ;ENDFOLD (BASISTECH INI)
 ;FOLD USER INI
   ;Make your modifications here

 ;ENDFOLD (USER INI)
;ENDFOLD (INI)
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
for l=1 to 64
last_Char[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
BZ=0
BX=0
BY=0
ZN=0
Xm=0.0
Ym=0.0
Zm=0.0
STATION_NO=0
RANK=0
ROW=0
LAST_STATION=0
LAST_RANK=0
LAST_ROW=0
VEL=0
;ENDFOLD INITIAL
PTP $POS_ACT
$ov_pro=5
PTP $POS_ACT
connectionname[]="XmlServer"
RET=EKI_Init("XmlServer")
RET=EKI_Open("XmlServer")
LOOP
IF $FLAG[1] THEN
;FOLD RESET
;BZ=0
;BX=0
;BY=0
;ZN=0
;Xm=0
;Ym=0
;Zm=0
;STATION_NO=0
;RANK=0
;ROW=0
;LAYER=0
;DOWN=FALSE
;UP=FALSE
;ENDFOLD RESET
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
RECEIVE_CharAndData()
SEND_CharAndData()
446
740249982
文章数:8
年度积分:50
历史总积分:446
注册时间:2016/11/29
发站内信
发表于:2016/11/29 15:23:15
#2楼
IF ((RECCHAR[1]=="G") AND (RECCHAR[2]=="O")) OR ((RECCHAR[1]=="S") AND (RECCHAR[2]=="C") AND (RECCHAR[3]=="A") AND (RECCHAR[4]=="N")) THEN
TRANSFER()
ENDIF
$OV_PRO=VEL
IF (RANK<>LAST_RANK) OR (ROW<>LAST_ROW)OR (STATION_NO<>LAST_STATION)OR (RECCHAR[1]<>LAST_CHAR[1])OR (RECCHAR[2]<>LAST_CHAR[2])OR (RECCHAR[3]<>LAST_CHAR[3])OR (RECCHAR[4]<>LAST_CHAR[4])OR (RECCHAR[5]<>LAST_CHAR[5])OR(RECCHAR[6]<>LAST_CHAR[6]) THEN

;FOLD CHECK STATUS()
IF (RECCHAR[1]=="O") AND (RECCHAR[2]=="N")AND (RECCHAR[3]=="A")AND (RECCHAR[4]=="C")AND (RECCHAR[5]=="T")THEN
;ONACT
SENDCHAR[]="KUKA KR16-2 ONACT"
WAIT FOR $FLAG[1]
SEND_CHAR()
ENDIF

IF (RECCHAR[1]=="L") AND (RECCHAR[2]=="A")AND (RECCHAR[3]=="S")AND (RECCHAR[4]=="T")AND (RECCHAR[5]=="P")AND (RECCHAR[6]=="O")AND (RECCHAR[7]=="S")THEN

;LASTPOS
SENDCHAR[]="LASTPOS"
WAIT FOR $FLAG[1]
SEND_CHAR()
ENDIF
IF (RECCHAR[1]=="O") AND (RECCHAR[2]=="F")AND (RECCHAR[3]=="F")AND (RECCHAR[4]=="A")AND (RECCHAR[5]=="C")AND (RECCHAR[6]=="T")THEN
   ; "OFFACT"
SENDCHAR[]=" KUKA KR270  OFFACT"
SEND_CHAR()
SENDCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CHAR()


;;;!!!!Bytes[]="ERROR"
;;;!!!!RET = EKI_Send("BinaryStream",Bytes[]
ENDIF
;ENDFOLD CHECK STATUS()
;FOLD PICK()
446
740249982
文章数:8
年度积分:50
历史总积分:446
注册时间:2016/11/29
发站内信
发表于:2016/11/29 15:24:21
#3楼
IF ((RECCHAR[1]=="P") AND (RECCHAR[2]=="I")AND (RECCHAR[3]=="C")AND (RECCHAR[4]=="K")) AND ((ZN==1) OR (ZN==2))THEN
IF (BZ>0) AND (BX>0) AND (BY>0) THEN

;PICKPIECE()
SENDCHAR[]="FINISH"
SEND_CHAR()
ENDIF
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
;ENDFOLD PICK()
GoSCAN()
GoPrepallet( )
GoRotation()
GoPallet()
GoLINE()
GoPalletUp()
;FOLD GOHOME()
IF (RECCHAR[1]=="H") AND (RECCHAR[2]=="O")AND (RECCHAR[3]=="M")AND (RECCHAR[4]=="E") THEN
gohome( )
STORE_DATA()
WAIT SEC 0
SENDCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CHAR()
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
;ENDFOLD GOHOME()
ELSE
RecChar[]="VALUE INVALID "
SEND_CharANDdata()
ENDIF
ENDIF
ENDLOOP

END
446
740249982
文章数:8
年度积分:50
历史总积分:446
注册时间:2016/11/29
发站内信
发表于:2016/11/29 15:25:22
#4楼
IF (ZN==9) or (zn==20) or (zn==21) or (zn==18) or (zn==19) THEN
PALLET_POS[RANK,ROW]=TP1
PALLET_POS[RANK,ROW].X=TP1.X+(RANK-1)*Xm
PALLET_POS[RANK,ROW].Y=TP1.Y+(ROW-1)*Ym
ELSE
PALLET_POS[RANK,ROW]=TP
PALLET_POS[RANK,ROW].X=TP.X+(RANK-1)*Xm
PALLET_POS[RANK,ROW].Y=TP.Y+(ROW-1)*Ym
ENDIF
PRE_PALLET=PALLET_POS[RANK,ROW]
PRE_PALLET.Z=PALLET_POS[RANK,ROW].Z+Zm
;ENDFOLD CALCULATE()
END
DEF GoPrepallet( )
IF ((RECCHAR[1]=="G") AND (RECCHAR[2]=="O")) THEN
IF (BZ>0) AND (BX>0) AND (BY>0) THEN
TOUCHPOINT( )
CALCULATE()
PTP PRE_PALLET
STORE_DATA()
WAIT SEC 0
RECCHAR[]="FINISH"
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
WAIT FOR $FLAG[1]
SEND_CharANDdata()
ENDIF
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF

END

DEF GoPallet()
IF (RECCHAR[1]=="D") AND (RECCHAR[2]=="O")AND(RECCHAR[3]=="W")AND(RECCHAR[4]=="N") THEN
TOUCHPOINT( )
CALCULATE()
;SET_TQ_VALUES (0,0,11,0,13,11)
IF (ZN==3) or (zn==2)  THEN
PRE_PALLET=PALLET_POS[RANK,ROW]
PRE_PALLET.Z=PRE_PALLET.Z-160
LIN PRE_PALLET
$OV_PRO=5
ENDIF
IF  (zn==1) THEN
PRE_PALLET=PALLET_POS[RANK,ROW]
PRE_PALLET.Z=PRE_PALLET.Z-340
LIN PRE_PALLET
$OV_PRO=5
ENDIF
446
740249982
文章数:8
年度积分:50
历史总积分:446
注册时间:2016/11/29
发站内信
发表于:2016/11/29 15:26:33
#5楼
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
END
DEF GoLINE()
IF (RECCHAR[1]=="L") AND (RECCHAR[2]=="I")AND(RECCHAR[3]=="N")AND(RECCHAR[4]=="E") THEN
TOUCHPOINT( )
CALCULATE()
;SET_TQ_VALUES (0,0,11,0,13,11)
IF (ZN==3) or (zn==2)  THEN
PRE_PALLET=PALLET_POS[RANK,ROW]
PRE_PALLET.Z=PRE_PALLET.Z-180
LIN PRE_PALLET
$OV_PRO=5
ENDIF
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
END

DEF GoPalletUp()
IF (RECCHAR[1]=="U") AND (RECCHAR[2]=="P") THEN
TOUCHPOINT( )
CALCULATE()
LIN PRE_PALLET
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
END
GLOBAL DEF SEND_CHAR()
;FOLD SEND_CHAR()
RET=EKI_SetString(ConnectionName[],"Robot/CMD",SENDCHAR[])
RET=EKI_Send(ConnectionName[],"Robot")
;ENDFOLD SEND_CHAR()
END

GLOBAL DEF SEND_CharAndData()
;FOLD SEND_CharAndData()
WAIT SEC 0.1
IF ((RECCHAR[1]=="R") AND (RECCHAR[2]=="B") AND (RECCHAR[3]=="T") AND (RECCHAR[4]=="P") AND (RECCHAR[5]=="O") AND (RECCHAR[6]=="S")) THEN
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
ENDIF
446
740249982
文章数:8
年度积分:50
历史总积分:446
注册时间:2016/11/29
发站内信
发表于:2016/11/29 15:27:34
#6楼
RET=EKI_SetINT(ConnectionName[],"Robot/STATION",ZN)
RET=EKI_SetINT(ConnectionName[],"Robot/N1",BY)
RET=EKI_SetINT(ConnectionName[],"Robot/N2",BX)
RET=EKI_SetINT(ConnectionName[],"Robot/N3",BZ)
RET=EKI_SetREAL(ConnectionName[],"Robot/N4",Xm)
RET=EKI_SetREAL(ConnectionName[],"Robot/N5",Ym)
RET=EKI_SetREAL(ConnectionName[],"Robot/N6",Zm)
RET=EKI_SetString(ConnectionName[],"Robot/CMD",RecChar[])
RET=EKI_Send(ConnectionName[],"Robot")
;ENDFOLD SEND_CharAndData()
END
GLOBAL DEF RECEIVE_CharAndData()
;FOLD RECEIVE_CharAndData()
WAIT SEC 0
wait for $flag[2] and $flag[3] and $flag[4] and $flag[5] and $flag[6] and $flag[7] and $flag[8] and $flag[9]
for d=2 to 9
$flag[d]=false
endfor
RET=EKI_GetINT(ConnectionName[],"Sensor/STATION",ZN)
RET=EKI_GetINT(ConnectionName[],"Sensor/N1",BY)
RET=EKI_GetINT(ConnectionName[],"Sensor/N2",BX)
RET=EKI_GetINT(ConnectionName[],"Sensor/N3",BZ)
RET=EKI_GetREAL(ConnectionName[],"Sensor/N4",Xm)
RET=EKI_GetREAL(ConnectionName[],"Sensor/N5",Ym)
RET=EKI_GetREAL(ConnectionName[],"Sensor/N6",Zm)
RET=EKI_GetSTRING(ConnectionName[],"Sensor/CMD",RecChar[])
INTERRUPT ON 128
;ENDFOLD RECEIVE_CharAndData()
END
GLOBAL DEF RECEIVE_Char()
;FOLD RECEIVE_Char()
wait for $flag[9]
for d=2 to 9
$flag[d]=false
endfor
RET=EKI_GetSTRING(ConnectionName[],"Sensor/CMD",RecChar[])
;ENDFOLD RECEIVE_Char()
END
DEF TRANSFER()
;FOLD TRANSFER()
STATION_NO=ZN
RANK=BX
ROW=BY
VEL=BZ
;ENDFOLD TRANSFER()
END
DEF GoRotation( )
IF ((RECCHAR[1]=="R") AND (RECCHAR[2]=="O")AND (RECCHAR[3]=="T")AND (RECCHAR[4]=="A")AND (RECCHAR[5]=="R")) THEN

TOUCHPOINT( )
CALCULATE()
PTP PRE_PALLET
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()

;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF

END

DEF GoSCAN( )
IF ((RECCHAR[1]=="S") AND (RECCHAR[2]=="C")AND (RECCHAR[3]=="A")AND (RECCHAR[4]=="N")) THEN

TOUCHPOINT( )
CALCULATE()
LIN PRE_PALLET
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()

;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF

END
DEF STORE_DATA()
LAST_RANK=RANK
LAST_ROW=ROW
LAST_STATION=STATION_NO
LAST_CHAR[]=RECCHAR[]
END
446
740249982
文章数:8
年度积分:50
历史总积分:446
注册时间:2016/11/29
发站内信
发表于:2016/11/29 15:28:36
#7楼
这是整套的程序,大神们,讲解下呗
DEF promain_0510( )
;FOLD INI
 ;FOLD BASISTECH INI
   BAS (#INITMOV,0 )
   INTERRUPT DECL 128 WHEN $flag[2]==true DO BufferRecData ( )
 ;ENDFOLD (BASISTECH INI)
 ;FOLD USER INI
   ;Make your modifications here

 ;ENDFOLD (USER INI)
;ENDFOLD (INI)
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
for l=1 to 64
last_Char[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
BZ=0
BX=0
BY=0
ZN=0
Xm=0.0
Ym=0.0
Zm=0.0
STATION_NO=0
RANK=0
ROW=0
LAST_STATION=0
LAST_RANK=0
LAST_ROW=0
VEL=0
;ENDFOLD INITIAL
PTP $POS_ACT
$ov_pro=5
PTP $POS_ACT
connectionname[]="XmlServer"
RET=EKI_Init("XmlServer")
RET=EKI_Open("XmlServer")
LOOP
IF $FLAG[1] THEN
;FOLD RESET
;BZ=0
;BX=0
;BY=0
;ZN=0
;Xm=0
;Ym=0
;Zm=0
;STATION_NO=0
;RANK=0
;ROW=0
;LAYER=0
;DOWN=FALSE
;UP=FALSE
;ENDFOLD RESET
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
RECEIVE_CharAndData()
SEND_CharAndData()
IF ((RECCHAR[1]=="G") AND (RECCHAR[2]=="O")) OR ((RECCHAR[1]=="S") AND (RECCHAR[2]=="C") AND (RECCHAR[3]=="A") AND (RECCHAR[4]=="N")) THEN
TRANSFER()
ENDIF
$OV_PRO=VEL
IF (RANK<>LAST_RANK) OR (ROW<>LAST_ROW)OR (STATION_NO<>LAST_STATION)OR (RECCHAR[1]<>LAST_CHAR[1])OR (RECCHAR[2]<>LAST_CHAR[2])OR (RECCHAR[3]<>LAST_CHAR[3])OR (RECCHAR[4]<>LAST_CHAR[4])OR (RECCHAR[5]<>LAST_CHAR[5])OR(RECCHAR[6]<>LAST_CHAR[6]) THEN

;FOLD CHECK STATUS()
IF (RECCHAR[1]=="O") AND (RECCHAR[2]=="N")AND (RECCHAR[3]=="A")AND (RECCHAR[4]=="C")AND (RECCHAR[5]=="T")THEN
;ONACT
SENDCHAR[]="KUKA KR16-2 ONACT"
WAIT FOR $FLAG[1]
SEND_CHAR()
ENDIF

IF (RECCHAR[1]=="L") AND (RECCHAR[2]=="A")AND (RECCHAR[3]=="S")AND (RECCHAR[4]=="T")AND (RECCHAR[5]=="P")AND (RECCHAR[6]=="O")AND (RECCHAR[7]=="S")THEN

;LASTPOS
SENDCHAR[]="LASTPOS"
WAIT FOR $FLAG[1]
SEND_CHAR()
ENDIF
IF (RECCHAR[1]=="O") AND (RECCHAR[2]=="F")AND (RECCHAR[3]=="F")AND (RECCHAR[4]=="A")AND (RECCHAR[5]=="C")AND (RECCHAR[6]=="T")THEN
   ; "OFFACT"
SENDCHAR[]=" KUKA KR270  OFFACT"
SEND_CHAR()
SENDCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CHAR()


;;;!!!!Bytes[]="ERROR"
;;;!!!!RET = EKI_Send("BinaryStream",Bytes[]
ENDIF
;ENDFOLD CHECK STATUS()
;FOLD PICK()
IF ((RECCHAR[1]=="P") AND (RECCHAR[2]=="I")AND (RECCHAR[3]=="C")AND (RECCHAR[4]=="K")) AND ((ZN==1) OR (ZN==2))THEN
IF (BZ>0) AND (BX>0) AND (BY>0) THEN

;PICKPIECE()
SENDCHAR[]="FINISH"
SEND_CHAR()
ENDIF
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
;ENDFOLD PICK()
GoSCAN()
GoPrepallet( )
GoRotation()
GoPallet()
GoLINE()
GoPalletUp()
;FOLD GOHOME()
IF (RECCHAR[1]=="H") AND (RECCHAR[2]=="O")AND (RECCHAR[3]=="M")AND (RECCHAR[4]=="E") THEN
gohome( )
STORE_DATA()
WAIT SEC 0
SENDCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CHAR()
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
;ENDFOLD GOHOME()
ELSE
RecChar[]="VALUE INVALID "
SEND_CharANDdata()
ENDIF
ENDIF
ENDLOOP

END

DEF  TOUCHPOINT( )
;FOLD TOUCHPOINT()
SWITCH  zn
CASE 1
;TP=Xconvey_pick
;$BASE=$NULLFRAME
TP=Xstation3
$BASE=BASE_DATA[3]
CASE 14
;TP=Xbuffur_pick
$BASE=BASE_DATA[2]
IF (ROW==1) AND (RANK==1) THEN
TP=Xbuffur_pick
ENDIF

IF (ROW==1) AND (RANK==3) THEN
TP=Xbuffur_pick3
ENDIF

IF (ROW==1) AND (RANK==5) THEN
TP=Xbuffur_pick5
ENDIF

CASE 3
;TP=Xstation3
;$BASE=BASE_DATA[3]
TP=Xstation4
$BASE=BASE_DATA[4]
CASE 4
TP=Xstation4
$BASE=BASE_DATA[4]

CASE 5
TP=Xstation5
$BASE=BASE_DATA[5]

CASE 6
TP=Xstation6_2
$BASE=$NULLFRAME
;$BASE=BASE_DATA[6]

CASE 7
TP=Xstation6_1
$BASE=$NULLFRAME
;$BASE=BASE_DATA[7]

CASE 8
TP=Xstation6_3
$BASE=$NULLFRAME
;$BASE=BASE_DATA[8]

CASE 9
TP1=Xstation7
;$BASE=$NULLFRAME
$BASE=BASE_DATA[11]

CASE 10
TP=Xstation6_4
$BASE=$NULLFRAME
;$BASE=BASE_DATA[8]

CASE 11
TP=Xstation7_L
;$BASE=$NULLFRAME
$BASE=BASE_DATA[11]

CASE 12
TP=XSCAN_L
$BASE=$NULLFRAME
;$BASE=BASE_DATA[8]

CASE 13
TP=XSCAN_R
$BASE=$NULLFRAME
;$BASE=BASE_DATA[8]

CASE 2
;TP=XBUFFER_PICK2
;$BASE=BASE_DATA[2]
TP=Xstation5
$BASE=BASE_DATA[5]
CASE 15
TP=XJIGSCAN1
$BASE=$NULLFRAME
;$BASE=BASE_DATA[8]

CASE 17
TP=XJIGSCAN2
$BASE=$NULLFRAME

CASE 16
TP=XJIGSCAN3
$BASE=$NULLFRAME

CASE 18
TP1=Xstation6_2R
$BASE=$NULLFRAME

CASE 19
TP1=Xstation6_1R
$BASE=$NULLFRAME

CASE 20
TP1=Xstation20_mid
$BASE=BASE_DATA[11]

CASE 21
TP1=Xstation21_R
$BASE=BASE_DATA[11]

CASE 22
TP=Xstation22_R_R
$BASE=BASE_DATA[11]

CASE 23
TP=Xstation23
$BASE=BASE_DATA[3]
;$BASE=$NULLFRAME

CASE 24
TP=Xstation24
$BASE=BASE_DATA[3]
;$BASE=$NULLFRAME

CASE 25
TP=Xstation25
$BASE=BASE_DATA[3]
;$BASE=$NULLFRAME

CASE 26
TP=Xstation26
;$BASE=$NULLFRAME
$BASE=BASE_DATA[3]
ENDSWITCH
;ENDFOLD TOUCHPOINT()
END
DEF CALCULATE()
;FOLD CALCULATE()


IF (ZN==9) or (zn==20) or (zn==21) or (zn==18) or (zn==19) THEN
PALLET_POS[RANK,ROW]=TP1
PALLET_POS[RANK,ROW].X=TP1.X+(RANK-1)*Xm
PALLET_POS[RANK,ROW].Y=TP1.Y+(ROW-1)*Ym
ELSE
PALLET_POS[RANK,ROW]=TP
PALLET_POS[RANK,ROW].X=TP.X+(RANK-1)*Xm
PALLET_POS[RANK,ROW].Y=TP.Y+(ROW-1)*Ym
ENDIF
PRE_PALLET=PALLET_POS[RANK,ROW]
PRE_PALLET.Z=PALLET_POS[RANK,ROW].Z+Zm
;ENDFOLD CALCULATE()
END
DEF GoPrepallet( )
IF ((RECCHAR[1]=="G") AND (RECCHAR[2]=="O")) THEN
IF (BZ>0) AND (BX>0) AND (BY>0) THEN
TOUCHPOINT( )
CALCULATE()
PTP PRE_PALLET
STORE_DATA()
WAIT SEC 0
RECCHAR[]="FINISH"
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
WAIT FOR $FLAG[1]
SEND_CharANDdata()
ENDIF
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF

END

DEF GoPallet()
IF (RECCHAR[1]=="D") AND (RECCHAR[2]=="O")AND(RECCHAR[3]=="W")AND(RECCHAR[4]=="N") THEN
TOUCHPOINT( )
CALCULATE()
;SET_TQ_VALUES (0,0,11,0,13,11)
IF (ZN==3) or (zn==2)  THEN
PRE_PALLET=PALLET_POS[RANK,ROW]
PRE_PALLET.Z=PRE_PALLET.Z-160
LIN PRE_PALLET
$OV_PRO=5
ENDIF
IF  (zn==1) THEN
PRE_PALLET=PALLET_POS[RANK,ROW]
PRE_PALLET.Z=PRE_PALLET.Z-340
LIN PRE_PALLET
$OV_PRO=5
ENDIF
;LIN PALLET_POS[RANK,ROW]
;SET_TQ_VALUES (0,0,0,0,0,0)
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
END
DEF GoLINE()
IF (RECCHAR[1]=="L") AND (RECCHAR[2]=="I")AND(RECCHAR[3]=="N")AND(RECCHAR[4]=="E") THEN
TOUCHPOINT( )
CALCULATE()
;SET_TQ_VALUES (0,0,11,0,13,11)
IF (ZN==3) or (zn==2)  THEN
PRE_PALLET=PALLET_POS[RANK,ROW]
PRE_PALLET.Z=PRE_PALLET.Z-180
LIN PRE_PALLET
$OV_PRO=5
ENDIF
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
END

DEF GoPalletUp()
IF (RECCHAR[1]=="U") AND (RECCHAR[2]=="P") THEN
TOUCHPOINT( )
CALCULATE()
LIN PRE_PALLET
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()
;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF
END
GLOBAL DEF SEND_CHAR()
;FOLD SEND_CHAR()
RET=EKI_SetString(ConnectionName[],"Robot/CMD",SENDCHAR[])
RET=EKI_Send(ConnectionName[],"Robot")
;ENDFOLD SEND_CHAR()
END

GLOBAL DEF SEND_CharAndData()
;FOLD SEND_CharAndData()
WAIT SEC 0.1
IF ((RECCHAR[1]=="R") AND (RECCHAR[2]=="B") AND (RECCHAR[3]=="T") AND (RECCHAR[4]=="P") AND (RECCHAR[5]=="O") AND (RECCHAR[6]=="S")) THEN
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
ENDIF
RET=EKI_SetINT(ConnectionName[],"Robot/STATION",ZN)
RET=EKI_SetINT(ConnectionName[],"Robot/N1",BY)
RET=EKI_SetINT(ConnectionName[],"Robot/N2",BX)
RET=EKI_SetINT(ConnectionName[],"Robot/N3",BZ)
RET=EKI_SetREAL(ConnectionName[],"Robot/N4",Xm)
RET=EKI_SetREAL(ConnectionName[],"Robot/N5",Ym)
RET=EKI_SetREAL(ConnectionName[],"Robot/N6",Zm)
RET=EKI_SetString(ConnectionName[],"Robot/CMD",RecChar[])
RET=EKI_Send(ConnectionName[],"Robot")
;ENDFOLD SEND_CharAndData()
END
GLOBAL DEF RECEIVE_CharAndData()
;FOLD RECEIVE_CharAndData()
WAIT SEC 0
wait for $flag[2] and $flag[3] and $flag[4] and $flag[5] and $flag[6] and $flag[7] and $flag[8] and $flag[9]
for d=2 to 9
$flag[d]=false
endfor
RET=EKI_GetINT(ConnectionName[],"Sensor/STATION",ZN)
RET=EKI_GetINT(ConnectionName[],"Sensor/N1",BY)
RET=EKI_GetINT(ConnectionName[],"Sensor/N2",BX)
RET=EKI_GetINT(ConnectionName[],"Sensor/N3",BZ)
RET=EKI_GetREAL(ConnectionName[],"Sensor/N4",Xm)
RET=EKI_GetREAL(ConnectionName[],"Sensor/N5",Ym)
RET=EKI_GetREAL(ConnectionName[],"Sensor/N6",Zm)
RET=EKI_GetSTRING(ConnectionName[],"Sensor/CMD",RecChar[])
INTERRUPT ON 128
;ENDFOLD RECEIVE_CharAndData()
END
GLOBAL DEF RECEIVE_Char()
;FOLD RECEIVE_Char()
wait for $flag[9]
for d=2 to 9
$flag[d]=false
endfor
RET=EKI_GetSTRING(ConnectionName[],"Sensor/CMD",RecChar[])
;ENDFOLD RECEIVE_Char()
END
DEF TRANSFER()
;FOLD TRANSFER()
STATION_NO=ZN
RANK=BX
ROW=BY
VEL=BZ
;ENDFOLD TRANSFER()
END
DEF GoRotation( )
IF ((RECCHAR[1]=="R") AND (RECCHAR[2]=="O")AND (RECCHAR[3]=="T")AND (RECCHAR[4]=="A")AND (RECCHAR[5]=="R")) THEN

TOUCHPOINT( )
CALCULATE()
PTP PRE_PALLET
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()

;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF

END

DEF GoSCAN( )
IF ((RECCHAR[1]=="S") AND (RECCHAR[2]=="C")AND (RECCHAR[3]=="A")AND (RECCHAR[4]=="N")) THEN

TOUCHPOINT( )
CALCULATE()
LIN PRE_PALLET
STORE_DATA()
WAIT SEC 0
 Xm=$pos_act.X
 Ym=$pos_act.Y
 Zm=$pos_act.Z
RECCHAR[]="FINISH"
WAIT FOR $FLAG[1]
SEND_CharANDdata()

;FOLD INITIAL
for l=1 to 64
RecChar[l]=0
endfor
FOR M=1 TO 64
SENDCHAR[M]=0
ENDFOR
;ENDFOLD INITIAL
WAIT FOR $FLAG[1]
RET=EKI_ClearBuffer("XmlServer","Sensor") ;clear connection
ENDIF

END
DEF STORE_DATA()
LAST_RANK=RANK
LAST_ROW=ROW
LAST_STATION=STATION_NO
LAST_CHAR[]=RECCHAR[]
END
878
菜根
文章数:296
年度积分:50
历史总积分:878
注册时间:2015/6/15
发站内信
发表于:2016/11/30 11:32:49
#8楼
虽然我都能看懂,但翻译工作量真不小。。。
582
bingliang68
文章数:5
年度积分:59
历史总积分:582
注册时间:2014/6/4
发站内信
发表于:2016/12/7 16:42:20
#9楼
你能把原工程文件发我一份吗,很多定义的变量都看不见316116997@qq.com

关于我们 | 联系我们 | 广告服务 | 本站动态 | 友情链接 | 法律声明 | 非法和不良信息举报

工控网客服热线:0755-86369299
版权所有 工控网 Copyright©2024 Gkong.com, All Rights Reserved

109.2007