一.干涉的定義
機(jī)器人在作業(yè)過(guò)程中,或者在運(yùn)行過(guò)程中,兩個(gè)或兩個(gè)以上的機(jī)器人同時(shí)占有同一區(qū)間位置而發(fā)生沖突叫干涉。因?yàn)楦缮婵赡芤鸬暮蠊校?/p>
機(jī)器人的部件損壞 |
任何因干涉而造成的不良后果,都將為客戶帶來(lái)不 可估計(jì)的損失! |
機(jī)器人程序混亂 | |
加工中的工件損壞 | |
周邊其他設(shè)備設(shè)施的損壞 |
二.干涉區(qū)間
同一工位的機(jī)器人,在工作過(guò)程中,需要進(jìn)入到同一個(gè)區(qū)域,但在進(jìn)入的先后次序無(wú)嚴(yán)格的限定,一臺(tái)機(jī)器人(Master)具有絕對(duì)優(yōu)先的權(quán)利,即該機(jī)器人首先進(jìn)入干涉區(qū),作業(yè)完成之后另一臺(tái)機(jī)器人(Slave)才可以進(jìn)入該干涉區(qū)工作。任意一臺(tái)機(jī)器人先進(jìn)入(Master),在工藝上都允許(除了影響運(yùn)行時(shí)間外),允許使用干涉區(qū)信號(hào)對(duì)控制機(jī)器人運(yùn)行,防止機(jī)器人之間碰撞。對(duì)于有嚴(yán)格的工藝時(shí)序的干涉,采用互鎖信號(hào)來(lái)控制。這種干涉區(qū)信號(hào)設(shè)置方法如圖所示。 ⑴如圖中,Rob2機(jī)器人為Master,Rob1機(jī)器人為Slave. Rob1和Rob2機(jī)器人在進(jìn)入干涉區(qū)之前首先分別對(duì)彼此進(jìn)行初始化(開(kāi)啟干涉區(qū)監(jiān)控并釋放干涉區(qū))。 ⑵機(jī)器人進(jìn)入干涉區(qū)三種情形:
1 | Rob1機(jī)器人進(jìn)入干涉區(qū)前,發(fā)送從機(jī)欲進(jìn)入干涉區(qū)的請(qǐng)求信號(hào),并檢測(cè)Rob2作為主機(jī)是否發(fā)送欲進(jìn)入干涉區(qū)的請(qǐng)求信號(hào)。如果主機(jī)Rob2進(jìn)入干涉區(qū)的請(qǐng)求信號(hào)被激活,無(wú)論此時(shí)Rob2進(jìn)入或則即將進(jìn)入干涉區(qū),此時(shí)Rob1都將停止運(yùn)動(dòng)并等待Rob2完成運(yùn)動(dòng)退出干涉區(qū)。 |
2 | 如果Rob1和Rob2同時(shí)發(fā)出欲進(jìn)入干涉區(qū)的請(qǐng)求信號(hào),Rob2機(jī)器人優(yōu)先進(jìn)入,此時(shí)Rob1都將停止運(yùn)動(dòng)并等待Rob2完成運(yùn)動(dòng)退出干涉區(qū)。 |
3 | 如果Rob1作為從機(jī)已進(jìn)入干涉區(qū)時(shí),Rob2若想進(jìn)入干涉區(qū),Rob2必須停止運(yùn)動(dòng)并等待Rob1完成運(yùn)動(dòng)退出干涉區(qū)。 |
⑶待進(jìn)入干涉區(qū)的機(jī)器人必須等待已進(jìn)入干涉區(qū)的機(jī)器人完成運(yùn)動(dòng)退出干涉區(qū)后方可進(jìn)入。
三.干涉區(qū)間互鎖編程思路:
創(chuàng)建名為Interlock的程序主要適用于存在有關(guān)聯(lián)的機(jī)器人組之間互鎖,該程序包含源代碼SRC文件和數(shù)據(jù)文件DAT兩個(gè)文件:
1.Interlock.dat數(shù)據(jù)文件說(shuō)明:
①枚舉類型互鎖指令E_LOCKTYPE:
GLOBAL ENUM E_LOCKTYPE ENTER_LOCK_M,ENTER_LOCK_S,LEAVE_LOCK,CYC_CONTROL,RESET_LOCK
互鎖命令 | 說(shuō)明 |
ENTER_LOCK_M | 作為主機(jī)器人進(jìn)入干涉區(qū) |
ENTER_LOCK_S | 作為從機(jī)器人進(jìn)入干涉區(qū) |
LEAVE_LOCK | 機(jī)器人退出干涉區(qū) |
CYC_CONTROL | 激活干涉區(qū)監(jiān)控中斷 |
RESET_LOCK | 初始化并釋放干涉區(qū) |
②結(jié)構(gòu)體型互鎖信號(hào)S_LOCKSIG:
GLOBAL STRUC S_LOCKSIG INTROB_IN,INTROB_OUT
互鎖信號(hào) | 說(shuō)明 |
ROB_IN | 其他機(jī)器人許可當(dāng)前機(jī)器人進(jìn)入干涉區(qū)的輸入信號(hào):TRUE表示許可 |
ROB_OUT | 當(dāng)前機(jī)器人進(jìn)入干涉區(qū)請(qǐng)求的輸出信號(hào):FALSE表示請(qǐng)求 |
③用于診斷的當(dāng)前機(jī)器人激活干涉區(qū)號(hào)zLockNumber:
GLOBAL INT zLockNumber=3
④干涉區(qū)監(jiān)控的中斷及循環(huán)旗幟的定義:
GLOBALCONSTINTczCollInterrupt=1;定義干涉區(qū)監(jiān)控的中斷等級(jí)GLOBALCONSTINTczCycCollision=1 ;定義干涉區(qū)監(jiān)控的循環(huán)旗幟號(hào)
⑤信號(hào)安全檢測(cè)時(shí)間,與SPS掃描周期:
GLOBALCONSTREALcrDeadtime=0.200000003 ;信號(hào)安全檢測(cè)時(shí)間,與SPS掃描周期
⑥干涉區(qū)互鎖信號(hào):
SIGNAL giRobotInterlock $IN[89] TO $IN[104] ;許可當(dāng)前機(jī)器人進(jìn)入干涉區(qū)的輸入信號(hào)組SIGNALgoRobotInterlock$OUT[89]TO$OUT[104] ;當(dāng)前機(jī)器人進(jìn)入干涉區(qū)請(qǐng)求的輸出信號(hào)組DECLS_LOCKSIGTABLE_LOCK[16];定義機(jī)器人干涉區(qū)的互鎖表TABLE_LOCK[1]={ROB_IN89,ROB_OUT89};機(jī)器人干涉區(qū)的互鎖1TABLE_LOCK[2]={ROB_IN 90,ROB_OUT 90} ;機(jī)器人干涉區(qū)的互鎖2TABLE_LOCK[3]={ROB_IN 91,ROB_OUT 91} ;機(jī)器人干涉區(qū)的互鎖3TABLE_LOCK[4]={ROB_IN 92,ROB_OUT 92} ;機(jī)器人干涉區(qū)的互鎖4TABLE_LOCK[5]={ROB_IN93,ROB_OUT93};機(jī)器人干涉區(qū)的互鎖5TABLE_LOCK[6]={ROB_IN94,ROB_OUT94};機(jī)器人干涉區(qū)的互鎖6TABLE_LOCK[7]={ROB_IN95,ROB_OUT95};機(jī)器人干涉區(qū)的互鎖7TABLE_LOCK[8]={ROB_IN 96,ROB_OUT 96} ;機(jī)器人干涉區(qū)的互鎖8TABLE_LOCK[9]={ROB_IN 97,ROB_OUT 97} ;機(jī)器人干涉區(qū)的互鎖9TABLE_LOCK[10]={ROB_IN 98,ROB_OUT 98} ;機(jī)器人干涉區(qū)的互鎖10TABLE_LOCK[11]={ROB_IN 99,ROB_OUT 99} ;機(jī)器人干涉區(qū)的互鎖11TABLE_LOCK[12]={ROB_IN 100,ROB_OUT 100} ;機(jī)器人干涉區(qū)的互鎖12TABLE_LOCK[13]={ROB_IN 101,ROB_OUT 101} ;機(jī)器人干涉區(qū)的互鎖13TABLE_LOCK[14]={ROB_IN 102,ROB_OUT 102} ;機(jī)器人干涉區(qū)的互鎖14TABLE_LOCK[15]={ROB_IN103,ROB_OUT103};機(jī)器人干涉區(qū)的互鎖15TABLE_LOCK[16]={ROB_IN 104,ROB_OUT 104} ;機(jī)器人干涉區(qū)的互鎖16
2.Interlock.src源程序文件說(shuō)明:
①Interlock源程序包含以下子程序:
子程序名 | 說(shuō)明 |
ANTI_COLLISION | 互鎖程序 |
STOP_ROB | 互鎖程序中的中斷程序 |
Msg_Anticoll | 互鎖激活的信息提示程序 |
SetMsg | 設(shè)置信息提示的程序 |
②互鎖程序ANTI_COLLISION(eiLockType:IN,ziLockNum:IN):
傳遞參數(shù) | 類型 | 取值 | 說(shuō)明 |
eiLockType | E_LOCKTYPE | #ENTER_LOCK_M | 作為主機(jī)請(qǐng)求進(jìn)入干涉區(qū) |
#ENTER_LOCK_S | 作為從機(jī)請(qǐng)求進(jìn)入干涉區(qū) | ||
#LEAVE_LOCK | 離開(kāi)干涉區(qū) | ||
#CYC_CONTROL | 干涉區(qū)初始化:激活互鎖中斷 | ||
#RESET_LOCK | 干涉區(qū)初始化:重置輸出信號(hào) | ||
ziLockNum | INT | 1…16 | 互鎖序號(hào):與TABLE_LOCK相對(duì) |
●#ENTER_LOCK_M程序邏輯:
1 | 禁用干涉區(qū)監(jiān)控中斷; |
2 |
判斷從站機(jī)器人是否已在該干涉區(qū): 1.若該值為真,表示與之對(duì)應(yīng)的機(jī)器人不在該干涉區(qū),此時(shí)輸出進(jìn)入干涉區(qū)請(qǐng)求信號(hào)假值; 2.若該值為假,則表示與之對(duì)應(yīng)的機(jī)器人在該干涉區(qū),此時(shí)中間變量nbOK置為假,并提示信息-主機(jī)該干涉區(qū)被其他從機(jī)器人激活,并等待從站機(jī)器人在該干涉區(qū)的信號(hào)為真,輸出從站機(jī)器人在該干涉區(qū)激活多久的信息;在循環(huán)中等待從站機(jī)器人在該干涉區(qū)的信號(hào)為真,此時(shí)輸出進(jìn)入干涉區(qū)請(qǐng)求信號(hào); |
3 | 激活干涉區(qū)監(jiān)控中斷; |
●#ENTER_LOCK_S程序邏輯:
1 | 禁用干涉區(qū)監(jiān)控中斷 |
2 |
中間變量nbOK置為假,并提示信息-該干涉區(qū)被主機(jī)器人激活,進(jìn)入循環(huán)判斷,判斷主機(jī)器人是否已激活 該干涉區(qū): 若該值為真,輸出進(jìn)入干涉區(qū)請(qǐng)求信號(hào)假值;等待一個(gè)時(shí)間在判斷判斷主機(jī)器人激活該干涉區(qū):如果該值為真,則將中間變量置真,并退出循環(huán);若該值為假,則將輸出進(jìn)入干涉區(qū)請(qǐng)求信號(hào)真值,讓主機(jī)器進(jìn)入干涉區(qū),該從機(jī)器人繼續(xù)等待主機(jī)器人激活該干涉區(qū)值為真; |
3 | 輸出進(jìn)入干涉區(qū)請(qǐng)求信號(hào)假值; |
4 | 激活干涉區(qū)監(jiān)控中斷; |
●#LEAVE_LOCK程序邏輯:
1 | 如果機(jī)器人不在路徑上,則等待機(jī)器人在路徑上; |
2 | 輸出進(jìn)入干涉區(qū)請(qǐng)求信號(hào)真值; |
●#RESET_LOCK程序邏輯:
1 | 等待機(jī)器人在路徑上; |
2 | 輸出進(jìn)入干涉區(qū)請(qǐng)求信號(hào)真值; |
●#CYC_CONTROL程序邏輯:
1 | 定義因互鎖引起的停機(jī)中斷; |
2 | 關(guān)閉中斷; |
3 | 定義中斷中的循環(huán)旗幟; |
4 | 開(kāi)啟中斷; |
5 | 激活中斷; |
代碼:
DEF Interlock( )END;-------------Interlock Active----------------------GLOBAL DEF ANTI_COLLISION(eiLockType:IN, ziLockNum:IN)DECL E_LOCKTYPE eiLockTypeDECL INT ziLockNumDECL BOOL nbOKCONTINUEIF VARSTATE("ziLockNum")<>#INITIALIZED THEN MsgQuit("Lock area not initialized") HALT ELSE IF ziLockNum>16 OR ziLockNum<1 THEN MsgQuit("Lock area msut be 1 to 16!") HALT ENDIFENDIFSWITCH eiLockType ; --- Enter Collision Zone as Master --- CASE #ENTER_LOCK_M WAIT SEC 0 INTERRUPT DISABLE czCollInterrupt ; Disable Monitoring IF ($IN[TABLE_LOCK[ziLockNum].ROB_IN]) THEN $OUT[TABLE_LOCK[ziLockNum].ROB_OUT]=FALSE ELSE nbOK=FALSE MSG_ANTICOLL(ziLockNum) REPEAT IF ($IN[TABLE_LOCK[ziLockNum].ROB_IN]) THEN nbOK=TRUE ELSE nbOK=FALSE ENDIF WAIT SEC 0.01 ; Sampling 100 ms UNTIL (INSTRUCTION_OK==TRUE) $OUT[TABLE_LOCK[ziLockNum].ROB_OUT]=FALSE ENDIF INTERRUPT ENABLE czCollInterrupt ; Enable Monitoring ; --- Enter Collsion Zone as Slave --- CASE #ENTER_LOCK_S WAIT SEC 0 INTERRUPT DISABLE czCollInterrupt ; Disable Monitoring nbOK=FALSE MSG_ANTICOLL(ziLockNum) REPEAT IF ($IN[TABLE_LOCK[ziLockNum].ROB_IN]) THEN $OUT[TABLE_LOCK[ziLockNum].ROB_OUT]=FALSE WAIT SEC crDeadtime IF ($IN[TABLE_LOCK[ziLockNum].ROB_IN]) THEN nbOK=TRUE ELSE nbOK=FALSE $OUT[TABLE_LOCK[ziLockNum].ROB_OUT]=TRUE ENDIF ENDIF WAIT SEC 0.01 ; Sampling 100 ms UNTIL (nbOK==TRUE) $OUT[TABLE_LOCK[ziLockNum].ROB_OUT]=FALSE INTERRUPT ENABLE czCollInterrupt ; Enable Monitoring ; --- Leave Collision Zone --- CASE #LEAVE_LOCK CONTINUE IF NOT $ON_PATH THEN WAIT FOR $ON_PATH ENDIF TRIGGER WHEN DISTANCE=1 DELAY=0 DO $OUT[TABLE_LOCK[ziLockNum].ROB_OUT]=TRUE; --- Initialize Collision Zone --- CASE #RESET_LOCK WAIT SEC 0 WAIT FOR $ON_PATH $OUT[TABLE_LOCK[ziLockNum].ROB_OUT]=TRUE ; --- Prepare for permanent Monitoring--- CASE #CYC_CONTROL GLOBAL INTERRUPT DECL czCollInterrupt WHEN NOT $CYCFLAG[czCycCollision] DO STOP_ROB( ) INTERRUPT OFF czCollInterrupt $CYCFLAG[czCycCollision]=TRUE $CYCFLAG[czCycCollision]=(((goRobotInterlock B_EXOR 'B1111111111111111') B_AND giRobotInterlock) == (goRobotInterlock B_EXOR 'B1111111111111111')) INTERRUPT ON czCollInterrupt INTERRUPT ENABLE czCollInterrupt; --- WARNING: Program Failure Interlocks --- DEFAULT HALT MsgNotify("Unknown Collision Setting!Please Switch Ti Mode!") WAIT FOR $T1ENDSWITCHENDGLOBAL DEF STOP_ROB ( ); *** Stop Movement by Interlock Monitoring*** BRAKE setmsg (99,3,0) WAIT FOR $CYCFLAG[czCycCollision]ENDGLOBAL DEF Msg_Anticoll(ziLockNum :IN)DECL INT ziLockNumDECL REAL nrTimernrTimer=0.0zLockNumber=ziLockNum;Message Outputsetmsg (ziLockNum,1,nzTimer) $TIMER_STOP[20]=TRUE$TIMER[20]=0$TIMER_STOP[20]=FALSEREPEAT WAIT sec .01UNTIL ($IN[TABLE_LOCK[ziLockNum].ROB_IN])==TRUE$TIMER_STOP[20]=TRUEnrTimer=$TIMER[20]nrTimer=nrTimer/1000.0setmsg (ziLockNum,2,nrTimer) ENDGLOBAL DEF SetMsg(ziLockNum:IN,ziMsg:IN,riPar:IN )DECL KrlMsg_T MsgDECL KrlMsgPar_T Par[3]DECL KrlMsgOpt_T OptDECL INT nzHandleDECL INT ziLockNum, ziMsgDECL REAL riPar;Select Msssage Text---------------------SWITCH ziMsg CASE 1 ;Interlock is Active Msg = {Modul[] "Interlock", Nr 007, Msg_txt[] "Interlock Area %1 is Active!"} CASE 2 ;Interlock was active Msg = {Modul[] "Interlock", Nr 008, Msg_txt[] "Interlock Area %1 was active %2[s] ago!"} CASE 3 ;Interlock Cycflag has triggered Msg = {Modul[] "Interlock", Nr 009, Msg_txt[] "Collision Monitoring has Triggered!"}ENDSWITCH;Configuration of message parameter --------Par[1] = {PAR_TYPE #VALUE, PAR_INT 0}Par[1].PAR_INT = ziLockAreaPar[2] = {PAR_TYPE #VALUE, PAR_REAL 00.0}Par[2].PAR_REAL = riPar;Message Options ------------------------------------Opt = {Vl_STOP FALSE, CLEAR_P_RESET TRUE, CLEAR_P_SAW FALSE, LOG_TO_DB TRUE};Message generation---------------------------nzHandle = SET_KRLMSG (#NOTIFY, Msg, Par[], Opt)END
四.互鎖信號(hào)程序的使用:
1.初始化干涉監(jiān)控:
ANTI_COLLISION(#CYC_CONTROL,0 )
2.重置并釋放干涉區(qū)信號(hào)-依據(jù)自己需求:
ANTI_COLLISION(#RESET_LOCK,1)ANTI_COLLISION(#RESET_LOCK,2)ANTI_COLLISION(#RESET_LOCK,3)ANTI_COLLISION(#RESET_LOCK,4)ANTI_COLLISION(#RESET_LOCK,5)ANTI_COLLISION(#RESET_LOCK,6)ANTI_COLLISION(#RESET_LOCK,7)ANTI_COLLISION(#RESET_LOCK,8)
3.進(jìn)入干涉區(qū):
-作為主機(jī)器人進(jìn)入:
ANTI_COLLISION(#ENTER_LOCK_M,3)ANTI_COLLISION(#ENTER_LOCK_M,4) ;三臺(tái)機(jī)器人同時(shí)進(jìn)入該區(qū)域ANTI_COLLISION(#ENTER_LOCK_M,5)
-作為從機(jī)器人進(jìn)入:
ANTI_COLLISION(#ENTER_LOCK_S,3)ANTI_COLLISION(#ENTER_LOCK_S,4) ;三臺(tái)機(jī)器人同時(shí)進(jìn)入該區(qū)域ANTI_COLLISION(#ENTER_LOCK_S,5)
復(fù)雜的互鎖建議最好由PLC來(lái)統(tǒng)一處理;
4.退出干涉區(qū):
ANTI_COLLISION(#LEAVE_LOCK,3)
五.說(shuō)明:
本文主要講述絕對(duì)優(yōu)先干涉區(qū)的設(shè)定,此種方法必須區(qū)分主次關(guān)系,主機(jī)器人獲得絕對(duì)的優(yōu)先處理的權(quán)力,而從機(jī)器人在遇到主從機(jī)器人同時(shí)進(jìn)入干涉區(qū)時(shí),獲得的優(yōu)先級(jí)低于主機(jī)器人,必須等待主機(jī)器人處理完退出干涉區(qū)之后才能進(jìn)入。
-
機(jī)器人
+關(guān)注
關(guān)注
211文章
28557瀏覽量
207692 -
源代碼
+關(guān)注
關(guān)注
96文章
2946瀏覽量
66831
原文標(biāo)題:庫(kù)卡機(jī)器人編程之干涉區(qū)間
文章出處:【微信號(hào):gh_a8b121171b08,微信公眾號(hào):機(jī)器人及PLC自動(dòng)化應(yīng)用】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論