サンプルプログラム21:MM_S21_1Robot_3IPC_Sequentially
プログラム概要
機能 |
1つのロボットが複数のIPCに接続され、1つのロボットで複数のビジョンシステムを制御します。 |
||
ファイル場所 |
Mech-VisionとMech-Vizソフトウェアのインストールディレクトリにある |
||
必要なプロジェクト |
Mech-VisionとMech-Vizプロジェクト
|
||
使用前提 |
|
| このサンプルプログラムは参考用です。ユーザーは実際の状況に応じて、このプログラムを基に変更を加える必要があります。このプログラムをそのまま使用しないでください。 |
プログラム説明
以下はMM_S21_1Robot_3IPC_Sequentiallyサンプルプログラムのコードと関連する説明です。
| 本サンプルは、1台のロボットを複数のIPCに接続する方法に焦点を当てています。各IPC上でのビジョンシステムの処理流れについては、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: ユーザザヒョウバンゴウ=0 ;
10: !set current tool NO. to 1 ;
11: ツールザヒョウバンゴウ=1 ;
12: ラベル[10] ;
13: ;
14: !initialize communication ;
15: !parameters(initialization is ;
16: !required once change IPC tcp ;
17: !service ;
18: ヨビダシ MM_INIT_SKT('8','192.168.1.20',30000,5) ;
19: !trigger Mech-Viz project ;
20: ヨビダシ MM_START_VIZ(0,60,53) ;
21: !check whether viz project has ;
22: !been triggered successfully ;
23: モシ (レジ[53]<>2103),ジャンプ ラベル[99] ;
24: タイキ .20(sec) ;
25: !set branch ;
26: ヨビダシ MM_SET_BCH(1,1,53) ;
27: !check whether viz branch has ;
28: !been set successfully ;
29: モシ (レジ[53]<>2105),ジャンプ ラベル[99] ;
30: ;
31: !initialize communication ;
32: !parameters(initialization is ;
33: !required once change IPC tcp ;
34: !service ;
35: ヨビダシ MM_INIT_SKT('8','192.168.1.200',30000,5) ;
36: !trigger Mech-Viz project ;
37: ヨビダシ MM_START_VIZ(0,61,53) ;
38: !check whether viz project has ;
39: !been triggered successfully ;
40: モシ (レジ[53]<>2103),ジャンプ ラベル[99] ;
41: タイキ .20(sec) ;
42: !set branch ;
43: ヨビダシ MM_SET_BCH(1,2,53) ;
44: !check whether viz branch has ;
45: !been set successfully ;
46: モシ (レジ[53]<>2105),ジャンプ ラベル[99] ;
47: ;
48: !initialize communication ;
49: !parameters(initialization is ;
50: !required once change IPC tcp ;
51: !service ;
52: ヨビダシ MM_INIT_SKT('8','192.168.1.50',30000,5) ;
53: !trigger Mech-Viz project ;
54: ヨビダシ MM_START_VIZ(0,62,53) ;
55: !check whether viz project has ;
56: !been triggered successfully ;
57: モシ (レジ[53]<>2103),ジャンプ ラベル[99] ;
58: タイキ .20(sec) ;
59: !set branch ;
60: ヨビダシ MM_SET_BCH(1,2,53) ;
61: !check whether viz branch has ;
62: !been set successfully ;
63: モシ (レジ[53]<>2105),ジャンプ ラベル[99] ;
64: ;
65: !initialize communication ;
66: !parameters(initialization is ;
67: !required once change IPC tcp ;
68: !service ;
69: ヨビダシ MM_INIT_SKT('8','192.168.1.20',30000,5) ;
70: !get planned path, 1st argument ;
71: !(1) means getting pose in JPs ;
72: ヨビダシ MM_GET_VIZ(1,51,52,53) ;
73: !check whether planned path has ;
74: !been got from Mech-Viz ;
75: !successfully ;
76: モシ (レジ[53]<>2100),ジャンプ ラベル[99] ;
77: !save the first waypoint of the ;
78: !planned path to local variables ;
79: !one by one ;
80: ヨビダシ MM_GET_JPS(1,70,71,72) ;
81: ;
82: !initialize communication ;
83: !parameters(initialization is ;
84: !required once change IPC tcp ;
85: !service ;
86: ヨビダシ MM_INIT_SKT('8','192.168.1.200',30000,5) ;
87: !get planned path, 1st argument ;
88: !(2) means getting pose in TCP ;
89: ヨビダシ MM_GET_VIZ(2,55,56,57,58) ;
90: !check whether planned path has ;
91: !been got from Mech-Viz ;
92: !successfully ;
93: モシ (レジ[53]<>2100),ジャンプ ラベル[99] ;
94: !save the first waypoint of the ;
95: !planned path to local variables ;
96: !one by one ;
97: ヨビダシ MM_GET_POS(1,71,73,74) ;
98: ;
99: !initialize communication ;
100: !parameters(initialization is ;
101: !required once change IPC tcp ;
102: !service ;
103: ヨビダシ MM_INIT_SKT('8','192.168.1.50',30000,5) ;
104: !get planned path, 1st argument ;
105: !(1) means getting pose in JPs ;
106: ヨビダシ MM_GET_VIZ(1,59,60,61,62) ;
107: !check whether planned path has ;
108: !been got from Mech-Viz ;
109: !successfully ;
110: モシ (レジ[53]<>2100),ジャンプ ラベル[99] ;
111: !save the first waypoint of the ;
112: !planned path to local variables ;
113: !one by one ;
114: ヨビダシ MM_GET_JPS(1,72,75,76) ;
115: ;
116: イチジテイシ ;
117: ジャンプ ラベル[10] ;
118: ;
119: ラベル[99:handling error] ;
120: !add error handling logic here ;
121: !according to different ;
122: !error codes ;
123: !e.g.: mm_status=2038 means no ;
124: !point cloud in ROI ;
125: !e.g.: mm_status=3099 means ;
126: !failed to open socket ;
127: イチジテイシ ;
上記のサンプルプログラムコードに対応する説明図は以下のようになります。図中の①~⑥は、プログラムの実行順序を示しています。
下表は上記のコードとその説明です。コマンド名のリンクをクリックすることで、その詳細な説明を確認できます。
| IPCのIPアドレスとポート番号 | コートと説明 | ||
|---|---|---|---|
192.168.1.20:30000 |
ロボットのポート6とIPC(192.168.1.20)のポート30000との通信流れは以下の通りです。
|
|
下図に示すように、FANUCロボットシステムの設定には、8つのポートが存在します。MM_INIT_SKT コマンドで未定義のポートを使用する場合、コントローラを再起動する必要があります。再起動しない場合、ロボットはビジョンシステムと通信できず、エラーが発生します。
|