样例程序13:MM_S13_Vis_MoveInAdvance
程序解读
以下为MM_S13_Vis_MoveInAdvance样例程序的代码及相关解释说明。
与MM_S1_Vis_Basic样例相比,本样例仅新增了拍照完成即可移动的功能(加粗部分的代码)。因此,下文不再重复解释与MM_S1_Vis_Basic样例相同部分的代码(详情请参考MM_S1_Vis_Basic样例说明)。 |
1: !-------------------------------- ;
2: !FUNCTION: trigger Mech-Vision ;
3: !then move to wait position and ;
4: !get vision pose in EIH setup ;
5: !Mech-Mind, 2023-12-25 ;
6: !-------------------------------- ;
7: ;
8: !set current uframe NO. to 0 ;
9: UFRAME_NUM=0 ;
10: !set current tool NO. to 1 ;
11: UTOOL_NUM=1 ;
12: !move to robot home position ;
13:J P[1] 100% FINE ;
14: !initialize communication ;
15: !parameters(initialization is ;
16: !required only once) ;
17: CALL MM_INIT_SKT('8','127.0.0.1',50000,5) ;
18: !move to image-capturing position ;
19:L P[2] 1000mm/sec FINE ;
20: !trigger NO.1 Mech-Vision project ;
21: CALL MM_START_VIS(1,0,1,10) ;
22: !move to wait position for ;
23: !picking ;
24:J P[3] 50% CNT100 ;
25: !get vision result from NO.1 ;
26: !Mech-Vision project ;
27: CALL MM_GET_VIS(1,51,53) ;
28: !check whether vision result has ;
29: !been got from Mech-Vision ;
30: !successfully ;
31: IF R[53]<>1100,JMP LBL[99] ;
32: !save first vision point data to ;
33: !local variables ;
34: CALL MM_GET_POS(1,60,70,80) ;
35: !move to intermediate waypoint ;
36: !of picking ;
37:J P[4] 50% CNT100 ;
38: !move to approach waypoint ;
39: !of picking ;
40:L PR[60] 1000mm/sec FINE Tool_Offset,PR[1] ;
41: !move to picking waypoint ;
42:L PR[60] 300mm/sec FINE ;
43: !add object grasping logic here, ;
44: !such as "DO[1]=ON" ;
45: PAUSE ;
46: !move to departure waypoint ;
47: !of picking ;
48:L PR[60] 1000mm/sec FINE Tool_Offset,PR[1] ;
49: !move to intermediate waypoint ;
50: !of placing ;
51:J P[5] 50% CNT100 ;
52: !move to approach waypoint ;
53: !of placing ;
54:L P[6] 1000mm/sec FINE Tool_Offset,PR[2] ;
55: !move to placing waypoint ;
56:L P[6] 300mm/sec FINE ;
57: !add object releasing logic here, ;
58: !such as "DO[1]=OFF" ;
59: PAUSE ;
60: !move to departure waypoint ;
61: !of placing ;
62:L P[6] 1000mm/sec FINE Tool_Offset,PR[2] ;
63: !move back to robot home position ;
64:J P[1] 100% FINE ;
65: END ;
66: ;
67: LBL[99:vision error] ;
68: !add error handling logic here ;
69: !according to different ;
70: !error codes ;
71: !e.g.: status=1003 means no ;
72: !point cloud in ROI ;
73: !e.g.: status=1002 means no ;
74: !vision results ;
75: PAUSE ;
上述样例程序代码对应的流程如下图所示。
下表为拍照完成即可移动的逻辑解读。用户单击指令名称的超链接便可查看该指令的详细说明。
流程 | 代码及说明 | ||||
---|---|---|---|---|---|
机器人在拍照完成后即可移动 |
在EIH场景中,为了让机器人在相机拍照完成后能够移动而不必等待Mech-Vision工程运行结束,用户可以在Mech-Vision软件中依次单击 ,勾选拍照完成再返回“1102:触发成功”。这样机器人在触发Mech-Vision工程并接收到“1102:触发成功”后,便可以开始移动,从而缩短节拍。如果用户未进行下图中的设置,当Mech-Vision工程成功开始运行后,视觉系统便立即向机器人返回1102状态码,此时机器人无法立即移动,因为无法判断相机是否完成拍照,所以机器人只能等待Mech-Vision工程运行结束后再移动。
上述代码表示,机器人在拍照完成后,便可移动至抓取等待点(P[3],用户需提前示教该点),如此Mech-Vision工程运行和机器人移动可并行执行,从而缩短节拍。
|