4.7.2. Robot Work Program
4.7.2. Robot Work Program
The following code is an example of a robot work program which performs RS232 communication. Add the following code to the communication part with “HRVision Press”.
' P1, P2 : Robot grip point P1=(X1,Y1,Z1,RX1,RY1,RZ1,CFG) ‘Upper side of the grip point P2=(X2,Y2,Z2,RX2,RY2,RZ2,CFG) ‘Grip point R1=(0,0,0,0,0,0)R CLR232C 2 ‘COM2 Port Buffer Clear _TEINPUT=13 ‘Carriage Return _TEINPUT=10 ‘Line Feed V1$="" V2$="" S1 MOVE P,S=100%,A=0,T=1 ‘Robot standby position PRINT #2,"TRACK 01“ ‘Model 1 recognition command V5%=0 INPUT #2,V5%,5,*ERROR ‘Receives the number of errors detected IF V5%>0 THEN GOTO *OK ELSE GOTO *NG ENDIF *OK CLR_RBUF #2 R1.CFG.REQ=2 PRINT #2,"CAMSFT 01“ ‘Requests the Shift Data of Camera 1 WAIT R1.CFG.ASSIGN ‘Shift Data Receive IF R1.RX=1 THEN ‘If RX=1, Camera 1 recognition failure PRINT #0,"CAM1 ERROR" ELSE ‘Work to be performed S2 MOVE P,P1+R1,S=80%,A=0,T=1 S3 MOVE L,P2+R1,S=80%,A=0,T=1 END *NG PRINT #0,"Vision NG“ END *ERROR PRINT #0,"Comm. NG“ END
|
The following code is an example of a robot work program which performs Ethernet communication. Add the following code to the communication part with “HRVision Press”.
' P1, P2 : Robot grip point P1=(X1,Y1,Z1,RX1,RY1,RZ1,CFG) ‘Upper side of the grip point P2=(X2,Y2,Z2,RX2,RY2,RZ2,CFG) ‘Grip point R1=(0,0,0,0,0,0)R 'ENET Comm. Setup 'Vision PC ENET1.IP="10.8.1.179" ENET1.RPORT=2000 ENET1.LPORT=5000 ENET1.OPEN 1 _TEINPUT=13 ‘Carriage Return _TEINPUT=10 ‘Line Feed 'Buffer Clear CLR_RBUF ENET1 ‘ENET Buffer Clear V1$="" V2$="" S1 MOVE P,S=100%,A=0,T=1 ‘Robot standby position PRINT ENET1,"TRACK 01" ‘Model 1 recognition command V5%=0 INPUT ENET1,V5%,5,*ERROR ‘Receives the number of errors detected IF V5%>0 THEN GOTO *OK ELSE GOTO *NG ENDIF *OK R1.CFG=17 PRINT ENET1,"CAMSFT 01" ‘Request for the Shift Data of Camera 1 INPUT ENET1,R1,3,*ERROR ‘Shift Data Receive R1.CFG=32 IF R1.RX=1 THEN ‘IF RX=1, Camera 1 recognition failure PRINT #0,"CAM1 ERROR" ENDIF ‘Work to be performed S2 MOVE P,P1+R1,S=80%,A=0,T=1 S3 MOVE L,P2+R1,S=80%,A=0,T=1 END *NG PRINT #0,"Vision NG“ END *ERROR PRINT #0,"Comm. NG“ END
|