样例程序21:MM_S21_1Robot_3IPC_Sequentially
程序解读
以下为MM_S21_1Robot_3IPC_Sequentially样例程序的代码及相关解释说明。
本样例侧重讲解一台机器人如何连接多台工控机的使用方法。每台工控机上视觉系统运行的逻辑流程,可参考MM_S5_Viz_SetBranch样例的解释说明(详情请参考MM_S5_Viz_SetBranch样例说明)。 |
1: !-------------------------------- ;
2: !FUNCTION: set up communication ;
3: !between 1Robot and 3IPC ;
4: !Sequentially ;
5: !Mech-Mind, 2024-4-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: LBL[10] ;
13: ;
14: !initialize communication ;
15: !parameters(initialization is ;
16: !required once change IPC tcp ;
17: !service ;
18: CALL MM_INIT_SKT('6','192.168.1.20',50000,5) ;
19: !trigger Mech-Viz project ;
20: CALL MM_START_VIZ(0,60) ;
21: WAIT .20(sec) ;
22: !set branch, "MM_SET_BCH ;
23: CALL MM_SET_BCH(1,1) ;
24: ;
25: !initialize communication ;
26: !parameters(initialization is ;
27: !required once change IPC tcp ;
28: !service ;
29: CALL MM_INIT_SKT('7','192.168.1.200',50000,5) ;
30: !trigger Mech-Viz project ;
31: CALL MM_START_VIZ(0,61) ;
32: WAIT .20(sec) ;
33: !set branch, "MM_SET_BCH ;
34: CALL MM_SET_BCH(1,2) ;
35: ;
36: !initialize communication ;
37: !parameters(initialization is ;
38: !required once change IPC tcp ;
39: !service ;
40: CALL MM_INIT_SKT('8','192.168.1.50',50000,5) ;
41: !trigger Mech-Viz project ;
42: CALL MM_START_VIZ(0,62) ;
43: WAIT .20(sec) ;
44: !set branch, "MM_SET_BCH ;
45: CALL MM_SET_BCH(1,2) ;
46: ;
47: !initialize communication ;
48: !parameters(initialization is ;
49: !required once change IPC tcp ;
50: !service ;
51: CALL MM_INIT_SKT('6','192.168.1.20',50000,5) ;
52: !get planned path, 1st argument ;
53: !(1) means getting pose in JPs ;
54: CALL MM_GET_VIZ(1,51,52,53) ;
55: !save the first waypoint of the ;
56: !planned path to local variables ;
57: !one by one ;
58: CALL MM_GET_JPS(1,70,71,72) ;
59: ;
60: !initialize communication ;
61: !parameters(initialization is ;
62: !required once change IPC tcp ;
63: !service ;
64: CALL MM_INIT_SKT('7','192.168.1.200',50000,5) ;
65: !get planned path, 1st argument ;
66: !(2) means getting pose in TCP ;
67: CALL MM_GET_VIZ(2,54,55,56) ;
68: !save the first waypoint of the ;
69: !planned path to local variables ;
70: !one by one ;
71: CALL MM_GET_POS(1,71,73,74) ;
72: ;
73: !initialize communication ;
74: !parameters(initialization is ;
75: !required once change IPC tcp ;
76: !service ;
77: CALL MM_INIT_SKT('8','192.168.1.50',50000,5) ;
78: !get planned path, 1st argument ;
79: !(1) means getting pose in JPs ;
80: CALL MM_GET_VIZ(1,57,58,59) ;
81: !save the first waypoint of the ;
82: !planned path to local variables ;
83: !one by one ;
84: CALL MM_GET_JPS(1,72,75,76) ;
85: ;
86: WAIT 5.00(sec) ;
87: JMP LBL[10] ;
上述样例程序代码对应的示意图如下所示。图中的①~⑥表示程序执行顺序。
下表为上述代码的逻辑解读。用户单击指令名称的超链接便可查看该指令的详细说明。
工控机IP地址及端口号 | 代码及说明 | ||
---|---|---|---|
192.168.1.20:50000 |
机器人端口6与工控机(192.168.1.20)端口50000的通信流程如下。
|
FANUC机器人系统设置中共有8个端口,如下图。用户在MM_INIT_SKT指令中使用未定义端口时,需要重启控制器才可生效,否则机器人无法与视觉系统通信,并报错。 |