样例程序18:MM_S18_Viz_GetUserData
程序解读
以下为MM_S18_Viz_GetUserData样例程序的代码及相关解释说明。
与MM_S15_Viz_GetDoList样例相比,本样例仅修改了如下加粗部分的代码。因此,下文不再重复解释与MM_S15_Viz_GetDoList样例相同部分的代码(详情请参考MM_S15_Viz_GetDoList样例说明)。 |
1: !-------------------------------- ;
2: !FUNCTION: trigger Mech-Viz ;
3: !project, then get planned path ;
4: !and get custom data from ;
5: !Mech-Vision using command 210 ;
6: !Mech-Mind, 2023-12-25 ;
7: !-------------------------------- ;
8: ;
9: !set current uframe NO. to 0 ;
10: UFRAME_NUM=0 ;
11: !set current tool NO. to 1 ;
12: UTOOL_NUM=1 ;
13: !move to robot home position ;
14:J P[1] 100% FINE ;
15: !initialize communication ;
16: !parameters(initialization is ;
17: !required only once) ;
18: CALL MM_INIT_SKT('8','127.0.0.1',50000,5) ;
19: !move to image-capturing position ;
20:L P[2] 1000mm/sec FINE ;
21: !trigger Mech-Viz project ;
22: CALL MM_START_VIZ(2,10) ;
23: !get planned path ;
24: CALL MM_GET_PLNDT(0,3,51,52,53) ;
25: !check whether planned path has ;
26: !been got from Mech-Viz ;
27: !successfully ;
28: IF R[53]<>2100,JMP LBL[99] ;
29: !get gripper control signal list ;
30: CALL MM_GET_DL(0,0) ;
31: !save waypoints of the planned ;
32: !path to local variables one ;
33: !by one ;
34: CALL MM_GET_PLJOP(1,3,60,61,62,63,64,70) ;
35: CALL MM_GET_PLJOP(2,3,61,91,92,93,94,100) ;
36: CALL MM_GET_PLJOP(3,3,62,121,122,123,124,130) ;
37: !save received custom data of ;
38: !2nd point ;
39: R[10]=R[94] ;
40: R[11]=R[95] ;
41: R[12]=R[96] ;
42: !follow the planned path to pick ;
43: !move to approach waypoint ;
44: !of picking ;
45:J PR[60] 50% FINE ;
46: !move to picking waypoint ;
47:J PR[61] 10% FINE ;
48: !add object grasping logic here ;
49: PAUSE ;
50: !set gripper control signal ;
51: CALL MM_SET_DL(0) ;
52: !move to departure waypoint ;
53: !of picking ;
54:J PR[62] 50% FINE ;
55: !move to intermediate waypoint ;
56: !of placing ;
57:J P[3] 50% CNT100 ;
58: !move to approach waypoint ;
59: !of placing ;
60:L P[4] 1000mm/sec FINE Tool_Offset,PR[2] ;
61: !move to placing waypoint ;
62:L P[4] 300mm/sec FINE ;
63: !add object releasing logic here, ;
64: !such as "DO[1]=OFF" ;
65: PAUSE ;
66: !move to departure waypoint ;
67: !of placing ;
68:L P[4] 1000mm/sec FINE Tool_Offset,PR[2] ;
69: !move back to robot home position ;
70:J P[1] 100% FINE ;
71: END ;
72: ;
73: LBL[99:vision error] ;
74: !add error handling logic here ;
75: !according to different ;
76: !error codes ;
77: !e.g.: status=2038 means no ;
78: !point cloud in ROI ;
79: PAUSE ;
上述样例程序代码对应的流程如下图所示。
下表为新增代码的逻辑解读。用户单击指令名称的超链接便可查看该指令的详细说明。
流程 | 代码及说明 | ||||
---|---|---|---|---|---|
保存路径点的自定义数据 |
机器人通过MM_GET_PLNDT指令获取路径点的视觉移动规划数据和自定义数据,然后再通过MM_GET_PLJOP指令将路径点的视觉移动规划数据和自定义数据从机器人内存中转存至指定寄存器中。示例中,抓取点(PR[61])的自定义数据从R[94]开始存放。 上述代码表示,将视觉移动路径点(抓取点)的三个自定义数据R[94]、R[95]和R[96]分别赋值给R[10]、R[11]和R[12]。
|