ABB机器人离线编程与仿真-原程序详解(搬运火花塞项目)
本次的任务是在已经构建好的工作站里面将火花塞从左侧工件托盘上搬运到右侧摆台上。在工作站配置中所使用的机器人是ABB IRB1410型机器人,并且事先已经使用Smart组件构建完成机器人所使用的工具的夹取和放置的动态效果。
程序注释:
MODULE MainMoudle
程序主模块
PERS tooldata tGripper:=[TRUE,[[0,0,123],[1,0,0,0]],[1,[0,0,60],[1,0,0,0],0,0,0]];
定义工具数据
TASK PERS wobjdata WobjPick:=[FALSE,TRUE,"",[[812.92,-380,554],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
定义左侧托盘工件坐标数据
TASK PERS wobjdata WobjPlace:=[FALSE,TRUE,"",[[812.112,131.704,629],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
定义右侧托盘工件坐标数据
PERS loaddata LoadEmpty:=[0.001,[0,0,0.001],[1,0,0,0],0,0,0];
定义空载载荷数据
PERS loaddata LoadFull:=[0.1,[0,0,5],[1,0,0,0],0,0,0];
定义抓取工件后的载荷数据
PERS robtarget pPick:=[[226.448,104.769,13.931],[0.00734292,-1.6E-08,0.999973,-1E-09],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
定义抓取数据,此数据随着抓取位置的不同而变化,是变量
定义放置数据,此数据随着抓取位置的不同而变化,是变量
CONST
robtarget
pHome:=[[873.054605526,0,764.656133294],[0.007342891,0,0.999973041,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
定义安全点
CONST
robtarget
pPickBase:=[[66.447802087,24.768906099,13.931002806],[0.007342918,-0.000000016,0.99997304,-0.000000001],
[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
定义抓取基准点
CONST
robtarget
pPlaceBase:=[[63.7807864,22.868891847,13.302282874],[0.006564124,0.698111195,0.715929802,-0.006495435],
[0,-1,1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
定义放置基准点
PERS num nPickH:=150; 定义抓取位置的安全距离
PERS num nPlaceH:=100; 定义放置位置的安全距离
PERS num nOffsX:=40; 定义X方向偏移数值
PERS num nOffsY:=40; 定义Y方向偏移数值
PERS num nCount:=16; 定义搬运数量并赋初始值为1,此数值随着搬运数量的变化而变化,是变量
PERS speeddata vMinSpeed:=[200,100,1000,5000];
PERS speeddata vMidSpeed:=[500,200,1000,5000];
PERS speeddata vMaxSpeed:=[800,300,1000,5000];定义高中低3种不同的运行速度,根据不同情况选择不同的运行速度
PROC Main()
主程序
rInitAll; 调用初始化子程序
WHILE TRUE DO
条件语句,通过这样的的调用方式,只运行初始化程序一次
rPick; 调用抓取子程序
rPlace; 调用放置子程序
ENDWHILE
ENDPROC
PROC rInitAll()
初始化子程序
ConfL\Off;
关闭线性运动和圆弧运动时的轴配置参数,使机器人能自由选择轴运动方式接近目标点,预防报警
ConfJ\Off;
关闭关节运动时的轴配置参数,使机器人能自由选择轴运动方式接近目标点,预防报警
AccSet 100,100; 设置加速度数据
VelSet 100,5000; 设置速度数据
Reset doGrip; 复位启动信号
nCount:=1; 搬运计数数值置1
MoveJ pHome,vMinSpeed,fine,tGripper\WObj:=wobj0;
利用关节运动指令移动TCP到安全点pHome
ENDPROC
PROC rPick()
抓取子程序
rCalPos; 调用计算位置子程序
MoveJ Offs(pPick,0,0,nPickH),vMaxSpeed,z50,tGripper\WObj:=wobjPick;
以关节运动方式高速运动到抓取点工件上方150mm处
MoveL pPick,vMinSpeed,fine,tGripper\WObj:=wobjPick;
以直线运动方式低速运动到待抓取工件位置
Set doGrip; 启动抓取操作
WaitTime 0.5; 等待0.5秒,确保抓取动作高质量完成
GripLoad LoadFull; 机器人满载
MoveL Offs(pPick,0,0,nPickH),vMidSpeed,z50,tGripper\WObj:=wobjPick;
以直线运动方式中速运动到待抓取工件上方150mm
ENDPROC
PROC rPlace()
放置子程序
MoveJ Offs(pPlace,0,0,nPlaceH),vMidSpeed,z50,tGripper\WObj:=wobjPlace;
以关节运动方式中速运动到待抓取工件上方100mm
MoveL pPlace,vMinSpeed,fine,tGripper\WObj:=wobjPlace;
以直线运动方式低速运动到待放置位置处
Reset doGrip;复位启动信号,放下火花塞
WaitTime 0.5;等待0.5秒,确保放置动作完成
GripLoad LoadEmpty;机器人空载
MoveL Offs(pPlace,0,0,nPickH),vMidSpeed,z50,tGripper\WObj:=wobjPlace;
以直线运动方式中速运动抬起100mm
rPlaceRD; 调用计数子程序
ENDPROC
PROC rPlaceRD()
计数子程序
nCount:=nCount+1;
搬运火花塞数量自增
IF nCount>32 THEN
IF条件判断指令,当计数变量大于32的时候向下执行
TPErase; 清屏
TPWrite "Pick&Place done,the robot will stop!";
在触摸屏上显示"Pick&Place done,the robot will stop!"
nCount:=1; 计数变量置1
Reset doGrip;启动复位信号
MoveJ pHome,vMinSpeed,fine,tGripper\WObj:=wobj0;
以关节运动形式低速运动到安全点
Stop;机器人停止
ENDIF
ENDPROC
PROC rCalPos()
计算位置子程序
!Row 1
TEST nCount
测量nCount变量,与CASE的数值作对比
CASE 1:
pPick:=Offs(pPickBase,0,0,0);
pPlace:=Offs(pPlaceBase,0,0,0);
CASE 2:
pPick:=Offs(pPickBase,nOffsX,0,0);
pPlace:=Offs(pPlaceBase,nOffsX,0,0);
CASE 3:
pPick:=Offs(pPickBase,2*nOffsX,0,0);
pPlace:=Offs(pPlaceBase,2*nOffsX,0,0);
CASE 4:
pPick:=Offs(pPickBase,3*nOffsX,0,0);
pPlace:=Offs(pPlaceBase,3*nOffsX,0,0);
!Row 2
CASE 5:
pPick:=Offs(pPickBase,-nOffsX,nOffsY,0);
pPlace:=Offs(pPlaceBase,-nOffsX,nOffsY,0);
CASE 6:
pPick:=Offs(pPickBase,0,nOffsY,0);
pPlace:=Offs(pPlaceBase,0,nOffsY,0);
CASE 7:
pPick:=Offs(pPickBase,nOffsX,nOffsY,0);
pPlace:=Offs(pPlaceBase,nOffsX,nOffsY,0);
CASE 8:
pPick:=Offs(pPickBase,2*nOffsX,nOffsY,0);
pPlace:=Offs(pPlaceBase,2*nOffsX,nOffsY,0);
CASE 9:
pPick:=Offs(pPickBase,3*nOffsX,nOffsY,0);
pPlace:=Offs(pPlaceBase,3*nOffsX,nOffsY,0);
CASE 10:
pPick:=Offs(pPickBase,4*nOffsX,nOffsY,0);
pPlace:=Offs(pPlaceBase,4*nOffsX,nOffsY,0);
!Row 3
CASE 11:
pPick:=Offs(pPickBase,-nOffsX,2*nOffsY,0);
pPlace:=Offs(pPlaceBase,-nOffsX,2*nOffsY,0);
CASE 12:
pPick:=Offs(pPickBase,0,2*nOffsY,0);
pPlace:=Offs(pPlaceBase,0,2*nOffsY,0);
CASE 13:
pPick:=Offs(pPickBase,nOffsX,2*nOffsY,0);
pPlace:=Offs(pPlaceBase,nOffsX,2*nOffsY,0);
CASE 14:
pPick:=Offs(pPickBase,2*nOffsX,2*nOffsY,0);
pPlace:=Offs(pPlaceBase,2*nOffsX,2*nOffsY,0);
CASE 15:
pPick:=Offs(pPickBase,3*nOffsX,2*nOffsY,0);
pPlace:=Offs(pPlaceBase,3*nOffsX,2*nOffsY,0);
CASE 16:
pPick:=Offs(pPickBase,4*nOffsX,2*nOffsY,0);
pPlace:=Offs(pPlaceBase,4*nOffsX,2*nOffsY,0);
!Row 4
CASE 17:
pPick:=Offs(pPickBase,-nOffsX,3*nOffsY,0);
pPlace:=Offs(pPlaceBase,-nOffsX,3*nOffsY,0);
CASE 18:
pPick:=Offs(pPickBase,0,3*nOffsY,0);
pPlace:=Offs(pPlaceBase,0,3*nOffsY,0);
CASE 19:
pPick:=Offs(pPickBase,nOffsX,3*nOffsY,0);
pPlace:=Offs(pPlaceBase,nOffsX,3*nOffsY,0);
CASE 20:
pPick:=Offs(pPickBase,2*nOffsX,3*nOffsY,0);
pPlace:=Offs(pPlaceBase,2*nOffsX,3*nOffsY,0);
CASE 21:
pPick:=Offs(pPickBase,3*nOffsX,3*nOffsY,0);
pPlace:=Offs(pPlaceBase,3*nOffsX,3*nOffsY,0);
CASE 22:
pPick:=Offs(pPickBase,4*nOffsX,3*nOffsY,0);
pPlace:=Offs(pPlaceBase,4*nOffsX,3*nOffsY,0);
!Row 5
CASE 23:
pPick:=Offs(pPickBase,-nOffsX,4*nOffsY,0);
pPlace:=Offs(pPlaceBase,-nOffsX,4*nOffsY,0);
CASE 24:
pPick:=Offs(pPickBase,0,4*nOffsY,0);
pPlace:=Offs(pPlaceBase,0,4*nOffsY,0);
CASE 25:
pPick:=Offs(pPickBase,nOffsX,4*nOffsY,0);
pPlace:=Offs(pPlaceBase,nOffsX,4*nOffsY,0);
CASE 26:
pPick:=Offs(pPickBase,2*nOffsX,4*nOffsY,0);
pPlace:=Offs(pPlaceBase,2*nOffsX,4*nOffsY,0);
CASE 27:
pPick:=Offs(pPickBase,3*nOffsX,4*nOffsY,0);
pPlace:=Offs(pPlaceBase,3*nOffsX,4*nOffsY,0);
CASE 28:
pPick:=Offs(pPickBase,4*nOffsX,4*nOffsY,0);
pPlace:=Offs(pPlaceBase,4*nOffsX,4*nOffsY,0);
!Row 6
CASE 29:
pPick:=Offs(pPickBase,0,5*nOffsY,0);
pPlace:=Offs(pPlaceBase,0,5*nOffsY,0);
CASE 30:
pPick:=Offs(pPickBase,nOffsX,5*nOffsY,0);
pPlace:=Offs(pPlaceBase,nOffsX,5*nOffsY,0);
CASE 31:
pPick:=Offs(pPickBase,2*nOffsX,5*nOffsY,0);
pPlace:=Offs(pPlaceBase,2*nOffsX,5*nOffsY,0);
CASE 32:
pPick:=Offs(pPickBase,3*nOffsX,5*nOffsY,0);
pPlace:=Offs(pPlaceBase,3*nOffsX,5*nOffsY,0);
计算火花塞抓取和放置位置数据
DEFAULT:
TPErase;清屏
TPWrite "the counter is error,please check it!";
在屏幕上显示"the counter is error,please check it!"
Stop;机器人停止
ENDPROC
PROC rTeachPos()
示教位置子程序
MoveL pHome,v1000,z100,tGripper\WObj:=wobj0;
示教安全点
MoveL pPickBase,v1000,z100,tGripper\WObj:=WobjPick;
示教抓取基准点
MoveL pPlaceBase,v1000,z100,tGripper\WObj:=WobjPlace;
示教放置基准点
ENDPROC
ENDMODULE
更多资讯:ABB工业机器人,ABB IRB 6700
- 下一篇:ABB工业机器人|ABB机器人基础编程
- 上一篇:详解ABB机器人外部轴的添加!!