サンプルプログラム16:MM_S16_Viz_GetDirection

現在ご覧いただいているのは2.0.0 バージョンの内容です。異なるバージョンを参照する場合は、画面右上のボタンから切り替えが可能です。

■ 最新版をご利用される場合は、弊社ホームページよりダウンロードが可能です。ダウンロードにはパスワードが必要となりますので、サポート窓口までお問い合わせください。

■ ご利用中のバージョンが分からない場合はお気軽にサポート窓口までご連絡ください。

プログラム概要

機能

ロボットが計画された経路を取得し、把持を実行した後、ワーク群の向きに基づいて異なる配置方法を使用します。

ファイル場所

Mech-VisionとMech-Vizソフトウェアのインストールディレクトリにある Communication Component/Robot_Interface/KUKA/sample/MM_S16_Viz_GetDirection

必要なプロジェクト

Mech-VisionとMech-Vizプロジェクト(ロボットハンド種類がデパレタイズ用吸盤である必要があります)

使用前提

  1. 標準インターフェース通信設定 が完了しました。

  2. 自動キャリブレーション が完了しました。

このサンプルプログラムは参考用です。ユーザーは実際の状況に応じて、このプログラムを基に変更を加える必要があります。このプログラムをそのまま使用しないでください。

プログラム説明

以下はMM_S16_Viz_GetDirectionサンプルプログラムのコードと関連する説明です。

このサンプルは、MM_S15_Viz_GetDoListサンプルに比べて、太字部分のコードのみが追加されています。そのため、MM_S15_Viz_GetDoListサンプルと同じ部分のコードについては、以下で再度説明することはありません(詳細は MM_S15_Viz_GetDoListサンプルの説明 をご参照ください)。
DEF  MM_S16_Viz_GetDirection ( )
;---------------------------------------------------
; FUNCTION: trigger Mech-Viz project, then get
; planned path and get box direction using command
; 210
; Mech-Mind, 2023-12-25
;---------------------------------------------------
   ;set current tool no. to 1
   BAS(#TOOL,1)
   ;set current base no. to 0
   BAS(#BASE,0)
   ;move to robot home position
PTP HOME Vel=100 % DEFAULT
   ;initialize communication parameters (initialization is required only once)
   MM_Init_Socket("XML_Kuka_MMIND",873,871,60)
   ;move to image-capturing position
LIN camera_capture Vel=1 m/s CPDAT1 Tool[1] Base[0]
   ;trigger Mech-Viz project
   MM_Start_Viz(2,init_jps)
   ;get planned path
   MM_Get_PlanData(0,3,pos_num,vis_pos_num,status)
   ;check whether planned path has been got from Mech-Viz successfully
   IF status<> 2100 THEN
      ;add error handling logic here according to different error codes
      ;e.g.: status=2038 means no point cloud in ROI
      halt
   ENDIF
   ;get gripper control signal list
   MM_Get_Dolist(0,0)
   ;save waypoints of the planned path to local variables one by one
   FOR count=1 TO pos_num
     MM_Get_PlanJps(count,3,pick_point[count],move_type[count],tool_num[count],speed[count])
   ENDFOR
   Xpick_point1=pick_point[1]
   Xpick_point2=pick_point[2]
   Xpick_point3=pick_point[3]
   ;follow the planned path to pick
   ;move to approach waypoint of picking
PTP pick_point1 Vel=50 % PDAT1 Tool[1] Base[0]
   ;move to picking waypoint
PTP pick_point2 Vel=10 % PDAT2 Tool[1] Base[0]
   ;add object grasping logic here
   halt
   ;set gripper control signal
   MM_Set_Dolist(0)
   ;move to departure waypoint of picking
PTP pick_point3 Vel=50 % PDAT3 Tool[1] Base[0]
   ;get box direction status from planned results
   box_direction=MM_Plan_Results[17]
   IF box_direction==0 THEN
      ;move to intermediate waypoint of placing
PTP drop_waypoint_1 CONT Vel=100 % PDAT4 Tool[1] Base[0]
      ;move to approach waypoint of placing
LIN drop_app_1 Vel=1 m/s CPDAT2 Tool[1] Base[0]
      ;move to placing waypoint
LIN drop_1 Vel=0.3 m/s CPDAT3 Tool[1] Base[0]
      ;add object releasing logic here, such as "$OUT[1]=FALSE"
      halt
      ;move to departure waypoint of placing
LIN drop_app_1 Vel=1 m/s CPDAT2 Tool[1] Base[0]
   ELSE
      ;move to intermediate waypoint of placing
PTP drop_waypoint_2 CONT Vel=100 % PDAT5 Tool[1] Base[0]
      ;move to approach waypoint of placing
LIN drop_app_2 Vel=1 m/s CPDAT4 Tool[1] Base[0]
      ;move to placing waypoint
LIN drop_2 Vel=0.3 m/s CPDAT5 Tool[1] Base[0]
      ;add object releasing logic here, such as "$OUT[1]=FALSE"
      halt
      ;move to departure waypoint of placing
LIN drop_app_2 Vel=1 m/s CPDAT4 Tool[1] Base[0]
   ENDIF
   ;move back to robot home position
PTP HOME Vel=100 % DEFAULT
END

上記のサンプルプログラムの処理流れは、下図の通りです。

sample16

下表は太字部分のコードとその説明です。コマンド名のリンクをクリックすることで、その詳細を確認できます。

処理流れ コートと説明

ワーク群の向きを取得

;get box direction status from planned results
box_direction=MM_Plan_Results[17]
Mech-Vizプロジェクトにおいて、「ビジョン処理による移動」の計画結果とは、「ビジョン処理による移動」ステップで計画されたデータを指します。このデータには、把持するワークのラベル、把持されたワークの合計数、今回把持されたワークの数、吸盤のエッジコーナー番号、TCPのオフセット、ワーク群の向き、単体ワークの向き、ワーク群の寸法が含まれます。

ロボットは MM_Get_PlanData コマンドを使用して経路点の「ビジョン処理による移動」の計画結果を取得し、その後、MM_Get_PlanJps コマンドを使用して経路点の「ビジョン処理による移動」の計画結果をロボットメモリからMM_Plan_Resultsデータグループに保存します。

MM_Plan_Resultsデータグループの中、MM_Plan_Results[17]は吸盤の長辺に対するワーク群の向きです。0は平行、1は垂直を意味します。

上記のコードは、MM_Plan_Results[17]をbox_direction変数に代入することを意味します。つまり、box_direction変数はワーク群の向きを示すようになります。

ワーク群の向きに基づいて異なる配置方法を使用

   IF box_direction==0 THEN
      ;move to intermediate waypoint of placing
PTP drop_waypoint_1 CONT Vel=100 % PDAT4 Tool[1] Base[0]
      ;move to approach waypoint of placing
LIN drop_app_1 Vel=1 m/s CPDAT2 Tool[1] Base[0]
      ;move to placing waypoint
LIN drop_1 Vel=0.3 m/s CPDAT3 Tool[1] Base[0]
      ;add object releasing logic here, such as "$OUT[1]=FALSE"
      halt
      ;move to departure waypoint of placing
LIN drop_app_1 Vel=1 m/s CPDAT2 Tool[1] Base[0]
   ELSE
      ;move to intermediate waypoint of placing
PTP drop_waypoint_2 CONT Vel=100 % PDAT5 Tool[1] Base[0]
      ;move to approach waypoint of placing
LIN drop_app_2 Vel=1 m/s CPDAT4 Tool[1] Base[0]
      ;move to placing waypoint
LIN drop_2 Vel=0.3 m/s CPDAT5 Tool[1] Base[0]
      ;add object releasing logic here, such as "$OUT[1]=FALSE"
      halt
      ;move to departure waypoint of placing
LIN drop_app_2 Vel=1 m/s CPDAT4 Tool[1] Base[0]
   ENDIF

上記のコードは、ワーク群が吸盤の長辺と平行している場合(box_directionが0の場合)、そのワーク群をdrop_1に配置します。それ以外の場合は、ワーク群をdrop_2に配置することを意味します。

この情報は役に立ちましたか?

ご意見・ご要望がございましたら、以下よりお寄せください:

Mech-Mindは、お客様のプライバシーを重視しています

このサイトでは最高の体験を提供するために Cookie を使用しています。サイトの閲覧を続ける場合、Cookie の使用に同意したことになります。「拒否する」を選択すると、このサイトを訪れた際に追跡や記憶が行われないように単独の Cookie が使用されます。