机器人编程技巧:自动堆垛和卸垛程序的关键语句(KUKA)
(2015-11-15 06:34:39)
标签:
defdeclptptpfor |
分类: 工业4.0/数字化/人工智能 |
【设计机器人界面信息】
例如设计三个选项分别是“XYZ”“ABC”“空”,用于显示放件时当前的位置状态。
DEF dui( )
decl krlmsg_t qe
decl krlmsgpar_t par[3]
decl krlmsgdlgsk_T SK[3]
DECL KRLMSGOPT_T OPT
DECL INT HAN,ANS
DECL BOOL Y,C
decl int n
decl int m
声明信息变量-----
INI
【理解$TOOL变量】
在$CONFIG.dat中声明变量$DECL FRAME TOOL_DATA[32]
首先被机器人算出的和你输入的工具坐标值会被保存在这里。它的变量类型是[FRAME] 表现形式例:
TOOL_DATA[1]={X 5.0,Y 0.0,Z 1414.0,A 0.0,B 0.0,C 0.0}
TOOL_DATA[2]={X 0.0,Y 0.0,Z 0.0,A 0.0,B 0.0,C 0.0}
TOOL_DATA[3]={X 0.0,Y 0.0,Z 0.0,A 0.0,B 0.0,C 0.0}
......uzuoTOOL_DATA[32]={X 0.0,Y 0.0,Z 0.0,A 0.0,B 0.0,bC 0.0}
当在编程时,我们需要使用工具坐标时:
$TOOL = tool_data[1] 这样你的轨迹就使用工具1进行工作。
【堆垛和卸垛程序示例】
堆垛.........
PTP fa2 Vel=100 % PDAT3 Tool[1]:1 Base[10]:g
for n=1 to 4 计算出16个点的位置值
for m=1 to 4
tp1[n,m]=xfa1 提取放件位置的数据
tp2[n,m]=xfa1 提取预放件位置的数据
tp1[n,m].y=tp1[n,m].y+80*(n-1)
tp1[n,m].x=tp1[n,m].x+65*(m-1)
tp2[n,m].z=tp2[n,m].z+100 预放件位置的Z轴方向要抬高100mm
tp2[n,m].y=tp2[n,m].y+80*(n-1)
tp2[n,m].x=tp2[n,m].x+65*(m-1)
endfor
endfor
PTP fa3 Vel=20 % PDAT4 Tool[1]:1 Base[10]:g
for n=1 to 4
for m=1 to 4
zhua() 循环执行抓件程序
PTP fa4 Vel=10 % PDAT5 Tool[1]:1 Base[10]:g
ptp tp2[n,m] 运行到预放件位置
wait sec 0.5
lin tp1[n,m] 运行到放件位置
wait sec 0.2
SET GRIPPER State= GDAT1 打开夹爪
lin tp1[n,m]
ptp tp2[n,m] 运行到抬起位置
endfor
endfor
PTP P1 Vel=50 % PDAT1 Tool[1]:1 Base[10]:g
例如设计三个选项分别是“XYZ”“ABC”“空”,用于显示放件时当前的位置状态。
DEF dui( )
decl krlmsg_t qe
decl krlmsgpar_t par[3]
decl krlmsgdlgsk_T SK[3]
DECL KRLMSGOPT_T OPT
DECL INT HAN,ANS
DECL BOOL Y,C
decl int n
decl int m
声明信息变量-----
INI
【理解$TOOL变量】
在$CONFIG.dat中声明变量$DECL FRAME TOOL_DATA[32]
首先被机器人算出的和你输入的工具坐标值会被保存在这里。它的变量类型是[FRAME] 表现形式例:
TOOL_DATA[1]={X 5.0,Y 0.0,Z 1414.0,A 0.0,B 0.0,C 0.0}
TOOL_DATA[2]={X 0.0,Y 0.0,Z 0.0,A 0.0,B 0.0,C 0.0}
TOOL_DATA[3]={X 0.0,Y 0.0,Z 0.0,A 0.0,B 0.0,C 0.0}
......uzuoTOOL_DATA[32]={X 0.0,Y 0.0,Z 0.0,A 0.0,B 0.0,bC 0.0}
当在编程时,我们需要使用工具坐标时:
$TOOL = tool_data[1] 这样你的轨迹就使用工具1进行工作。
【堆垛和卸垛程序示例】
堆垛.........
PTP fa2 Vel=100 % PDAT3 Tool[1]:1 Base[10]:g
for n=1 to 4
for m=1 to 4
tp1[n,m]=xfa1
tp2[n,m]=xfa1
tp1[n,m].y=tp1[n,m].y+80*(n-1)
tp1[n,m].x=tp1[n,m].x+65*(m-1)
tp2[n,m].z=tp2[n,m].z+100
tp2[n,m].y=tp2[n,m].y+80*(n-1)
tp2[n,m].x=tp2[n,m].x+65*(m-1)
endfor
endfor
PTP fa3 Vel=20 % PDAT4 Tool[1]:1 Base[10]:g
for n=1 to 4
for m=1 to 4
zhua()
PTP fa4 Vel=10 % PDAT5 Tool[1]:1 Base[10]:g
ptp tp2[n,m]
wait sec 0.5
lin tp1[n,m]
wait sec 0.2
SET GRIPPER State= GDAT1
lin tp1[n,m]
ptp tp2[n,m]
endfor
endfor
PTP P1 Vel=50 % PDAT1 Tool[1]:1 Base[10]:g