样例程序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',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: !follow the planned path to pick ;
38: !move to approach waypoint ;
39: !of picking ;
40:J PR[60] 50% FINE ;
41: !move to picking waypoint ;
42:J PR[61] 10% FINE ;
43: !add object grasping logic here ;
44: PAUSE ;
45: !set gripper control signal ;
46: CALL MM_SET_DL(0) ;
47: !move to departure waypoint ;
48: !of picking ;
49:J PR[62] 50% FINE ;
50: !move to intermediate waypoint ;
51: !of placing ;
52:J P[3] 50% CNT100 ;
53: !move to approach waypoint ;
54: !of placing ;
55:L P[4] 1000mm/sec FINE Tool_Offset,PR[2] ;
56: !move to placing waypoint ;
57:L P[4] 300mm/sec FINE ;
58: !add object releasing logic here, ;
59: !such as "DO[1]=OFF" ;
60: PAUSE ;
61: !move to departure waypoint ;
62: !of placing ;
63:L P[4] 1000mm/sec FINE Tool_Offset,PR[2] ;
64: !move back to robot home position ;
65:J P[1] 100% FINE ;
66: END ;
67: ;
68: LBL[99:vision error] ;
69: !add error handling logic here ;
70: !according to different ;
71: !error codes ;
72: !e.g.: status=2038 means no ;
73: !point cloud in ROI ;
74: PAUSE ;
上述样例程序代码对应的流程如下图所示。
下表是对加粗代码的逻辑解读。用户单击指令名称的超链接便可查看该指令的详细说明。
流程 | 代码及说明 | ||
---|---|---|---|
获取规划路径 |
|
||
获取吸盘DO信号 |
|
||
转存规划路径 |
因此,“CALL MM_GET_PLJOP(1,3,60,61,62,63,64,70)”整条指令表示将第一个路径点的位姿、移动类型、末端工具编号、速度、自定义数据和视觉移动规划数据分别转存至指定寄存器。
|
||
移动到抓取点进行抓取 |
因此,上述语句表示,机器人在移动到抓取点(PR[61])后,通过MM_SET_DL指令设置吸盘DO信号,从而完成抓取。 |