样例程序15:MM_S15_Viz_GetDoList
程序解读
以下为MM_S15_Viz_GetDoList样例程序的代码及相关解释说明。
| 与MM_S2_Viz_Basic样例相比,本样例仅修改了如下加粗部分的代码。因此,下文不再重复解释与MM_S2_Viz_Basic样例相同部分的代码(详情请参考MM_S2_Viz_Basic样例说明)。 |
1: !-------------------------------- ;
2: !FUNCTION: trigger Mech-Viz ;
3: !project, then get planned path ;
4: !and gripper control signal using ;
5: !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',30000,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,53) ;
23: !check whether viz project has ;
24: !been triggered successfully ;
25: IF (R[53]<>2103),JMP LBL[99] ;
26: !get planned path ;
27: CALL MM_GET_PLNDT(0,3,51,52,53) ;
28: !check whether planned path has ;
29: !been got from Mech-Viz ;
30: !successfully ;
31: IF R[53]<>2100,JMP LBL[99] ;
32: !get gripper control signal list ;
33: CALL MM_GET_DL(0,0,53) ;
34: !check whether viz DoList has ;
35: !been gotten successfully ;
36: IF (R[53]<>2102),JMP LBL[99] ;
37: !save waypoints of the planned ;
38: !path to local variables one ;
39: !by one ;
40: CALL MM_GET_PLJOP(1,3,60,61,62,63,64,70) ;
41: CALL MM_GET_PLJOP(2,3,61,91,92,93,94,100) ;
42: CALL MM_GET_PLJOP(3,3,62,121,122,123,124,130) ;
43: !follow the planned path to pick ;
44: !move to approach waypoint ;
45: !of picking ;
46:J PR[60] 50% FINE ;
47: !move to picking waypoint ;
48:J PR[61] 10% FINE ;
49: !add object grasping logic here ;
50: PAUSE ;
51: !set gripper control signal ;
52: CALL MM_SET_DL(0) ;
53: !move to departure waypoint ;
54: !of picking ;
55:J PR[62] 50% FINE ;
56: !move to intermediate waypoint ;
57: !of placing ;
58:J P[3] 50% CNT100 ;
59: !move to approach waypoint ;
60: !of placing ;
61:L P[4] 1000mm/sec FINE Tool_Offset,PR[2] ;
62: !move to placing waypoint ;
63:L P[4] 300mm/sec FINE ;
64: !add object releasing logic here, ;
65: !such as "DO[1]=OFF" ;
66: PAUSE ;
67: !move to departure waypoint ;
68: !of placing ;
69:L P[4] 1000mm/sec FINE Tool_Offset,PR[2] ;
70: !move back to robot home position ;
71:J P[1] 100% FINE ;
72: END ;
73: ;
74: LBL[99:vision error] ;
75: !add error handling logic here ;
76: !according to different ;
77: !error codes ;
78: !e.g.: status=2038 means no ;
79: !point cloud in ROI ;
80: !e.g.: mm_status=3099 means ;
81: !failed to open socket ;
82: PAUSE ;
上述样例程序代码对应的流程如下图所示。
下表是对加粗代码的逻辑解读。用户单击指令名称的超链接便可查看该指令的详细说明。
| 流程 | 代码及说明 | ||
|---|---|---|---|
获取规划路径 |
|
||
获取吸盘DO信号 |
|
||
转存规划路径 |
因此,“CALL MM_GET_PLJOP(1,3,60,61,62,63,64,70)”整条指令表示将第一个路径点的位姿、移动类型、末端工具编号、速度、自定义数据和视觉移动规划数据分别转存至指定寄存器。
|
||
移动到抓取点进行抓取 |
因此,上述语句表示,机器人在移动到抓取点(PR[61])后,通过MM_SET_DL指令设置吸盘DO信号,从而完成抓取。 |