ABB工业机器人期末考试
2018-2019学年第二学期《工业机器人》
专业:机械制造与自动化
学号:****
姓名:***
日期:2018.06.02
MODULE Module1
VAR bool flag1:=FALSE;
VAR bool flag2:=FALSE;
CONST robtarget p10:=[[1493.98,3.43,681.06],[1.80999E-06,-
5.23109E-20,-1,4.15101E-
09],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p20:=[[1493.99,3.43,1314.39],[1.80999E-06,-
1.28751E-21,-1,4.151E-
09],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p30:=[[182.89,1878.34,1230.40],[1.33905E-
06,0.671121,-0.741348,1.2178E-
06],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p40:=[[-17.52,420.16,245.91],[1.42945E-
06,0.71281,-0.701357,6.31922E-07],[0,0,-
1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
VAR robtarget p50:=[[182.89,1878.35,279.7],[1.41089E-
06,0.715128,-0.698994,1.13378E-06],[0,0,-
1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
TASK PERS wobjdata
wobj1:=[FALSE,TRUE,"",[[426.599,1340.71,7.64007],[1,-3.00914E-07,-1.42534E-07,-4.28905E-14]],[[0,0,0],[1,0,0,0]]];
CONST robtarget p60:=[[-20.53,408.94,-221.32],[0.703892,1.50664E-06,9.3966E-07,-0.710307],[-
1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
TASK PERS wobjdata wobj2:=[FALSE,TRUE,"",[[428.276,-
1349.94,25.5339],[3.52804E-08,-1,0,0]],[[0,0,0],[1,0,0,0]]];
!***********************************************************
!
! Module: Module1
!
! Description:
!
!
! Author: Administrator
!
! Version: 1.0
!
!***********************************************************
!***********************************************************
!
! Procedure main
!
! This is the entry point of your program
!
!***********************************************************
PROC main() ----主程序main !Add your code here
init; ----例行程序:回零程序FOR i FROM 1 TO 15 DO ----工件个数15个reg1 := i; ----调用指定程序i
PANDUAN; ----调用判断程序panduan ENDFOR
ENDPROC
PROC Routine1()
IF TRUE THEN
WaitDI diBoxInPos, 1----等待一个输入信号状态为1,输出工件
MoveJ p10, v1000, fine, tool0; ----移动位置为p10
Set doGripper; ----拾取工件
MoveJ p20, v1000, fine, tool0; ----移动到p20位置
WaitDI diVacuumOK, 1;
MoveJ Offs(p50,0,0,520), v1000, fine, tool0\WObj:=wobj1;
----移动到p50位置上方400距离MoveL p50, v1000, fine, tool0\WObj:=wobj1;
----直线移动到p50 Reset doGripper; ----复位吸盘,放置工件
WaitTime 0.3; ----等待0.3秒
MoveL Offs(p50,0,0,520), v1000, fine, tool0\WObj:=wobj1;
----移动到p50位置上方400距离MoveAbsJ
[[0,0,0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]\NoEOffs, v1000, fine, tool0; ----移动到绝对位置指令ENDIF
ENDPROC
PROC Routine2()
IF TRUE THEN
WaitDI diBoxInPos, 1;
MoveJ p10, v1000, fine, tool0;
Set doGripper;
MoveJ p20, v1000, fine, tool0;
WaitDI diVacuumOK, 1;
MoveJ Offs(p50,0,0,-520), v1000, fine, tool0\WObj:=wobj2;
MoveL p50, v1000, fine, tool0\WObj:=wobj2;
Reset doGripper;
WaitTime 0.3;
MoveL Offs(p50,0,0,-520), v1000, fine, tool0\WObj:=wobj2;
MoveAbsJ
[[0,0,0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]\NoEOffs, v1000, fine, tool0;
ENDIF
ENDPROC
PROC init()
MoveAbsJ
[[0,0,0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]\NoEOffs, v1000, z50, tool0;
Set doStartCNV;
WaitTime 0.3;
ENDPROC
PROC PANDUAN() ----声明判断程序TEST reg1 ----对变量p50进行位置判断,依次放置工件
CASE 1:
p50 := p40; ----放置工件1的位置为p40
Routine1; ----调用例行程序routinel1 CASE 2:
p50 := Offs(p40,-401,0,0);
----若为2时计算放置位置为P40X轴-401 Routine1;
CASE 3:
p50 := Offs(p40,-801,0,0);
----若为3时计算放置位置为P40X轴-801 Routine1;
CASE 4:
p50 := Offs(p40,-100,-480,0);
----若为4时计算放置位置为P40X轴-100,Y轴-480 p50 := RelTool(p50,0,0,0\Rz:=90);
----将上一步的P50变量再旋转90°Routine1;
CASE 5:
p50 := Offs(p40,-680,-495,0);
----若为5时计算放置位置为P40X轴-680,Y轴-495 p50 := RelTool(p50,0,0,0\Rz:=-90);
----将上一步的P50变量再旋转-90°Routine1;
CASE 6:
p50 := Offs(p40,0,-430,250);
----若为6时计算放置位置为P40 X轴0,Y轴-430,Z轴250 Routine1;
CASE 7:
p50 := Offs(p40,-401,-430,250);
----若为7时计算放置位置为P40 X轴-401,Y轴-430,Z轴250 Routine1;
CASE 8:
p50 := Offs(p40,-801,-430,250);
----若为8时计算放置位置为P40 X轴-801,Y轴430,Z轴250 Routine1;
CASE 9:
p50 := Offs(p40,-100,110,250);
----若为9时计算放置位置为P40 X轴-100,Y轴110,Z轴250 p50 := RelTool(p50,0,0,0\Rz:=90);
----将上一步的P50变量再旋转90°Routine1;
CASE 10:
p50 := Offs(p40,-680,80,250);
----若为10时计算放置位置为P40 X轴-680,Y轴80,Z轴250 p50 := RelTool(p50,0,0,0\Rz:=-90);
----将上一步的P50变量再旋转-90°Routine1;
CASE 11:
p50 := p60; ----放置工件的位置为p60
Routine2; ----调用例行程序routinel2 CASE 12:
p50 := Offs(p60,-401,0,0);
----若为12时计算放置位置为P60X轴-401 Routine2;
CASE 13:
p50 := Offs(p60,-801,0,0);
----若为13时计算放置位置为P60X轴-801 Routine2;
CASE 14:
p50 := Offs(p60,-100,-480,0);
----若为14时计算放置位置为P60X轴-100,Y轴的-480
p50 := RelTool(p50,0,0,0\Rz:=90);
----将上一步的P50变量再旋转90°Routine2;
CASE 15:
p50 := Offs(p60,-700,-480,0);
----若为15时计算放置位置为P60X轴-700,Y轴的-480 p50 := RelTool(p50,0,0,0\Rz:=90);
----将上一步的P50变量再旋转90°Routine2;
ENDTEST
ENDPROC
ENDMODULE