Example Program 21: MM_S21_1Robot_3IPC_Sequentially

You are currently viewing the documentation for the latest version (2.1.0). To access a different version, click the "Switch version" button located in the upper-right corner of the page.

■ If you are not sure which version of the product you are currently using, please feel free to contact Mech-Mind Technical Support.

Program Introduction

Description

The robot connects multiple IPCs, which means that one robot can control multiple vision systems.

File path

You can navigate to the installation directory of Mech-Vision and Mech-Viz and find the file by using the Communication Component/Robot_Interface/FANUC/sample/MM_S21_1Robot_3IPC_Sequentially path.

Project

Mech-Vision and Mech-Viz projects

The Mech-Viz project in each IPC requires that the Branch by Msg Step be configured beforehand.

Prerequisites

This example program is provided for reference only. Before using the program, please modify the program according to the actual scenario.

Program Description

This part describes the MM_S21_1Robot_3IPC_Sequentially example program.

This example program focuses on how to connect one robot to multiple IPCs. For information about how a vision system runs on each IPC, see the relevant description in Example Program 5: 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] ;

The process corresponding to the above example program code is shown in the figure below. ① to ⑥ indicate the sequence in which the program is executed.

sample21

The table below describes the above code. You can click the hyperlink to the command name to view its detailed description.

IPC IP address and port number Code and description

192.168.1.20:50000

  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) ;
  ...
  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) ;

To set up communication between the robot and the IPC, use the robot’s port 6, the IP address 192.168.1.20, and port 50000 of the IPC. The procedure is as follows.

  1. The robot runs the MM_INIT_SKT command to initialize communication parameters, allowing it to establish communication with the vision system in the IPC.

  2. The robot runs the MM_START_VIZ command to trigger the Mech-Viz project to run.

  3. The robot runs the MM_SET_BCHcommand to set the exit port of the Branch by Msg Step in Mech-Viz.

  4. The robot connects other IPCs by using other ports, and closes the connection between the first IPC (indicated by its IP address 192.168.1.20).

  5. The robot runs the MM_INIT_SKT command to establish the communication with the vision system in the IPCs.

  6. The robot runs the MM_GET_VIZ command to obtain the planned path from Mech-Viz.

  7. The robot runs the MM_GET_JPS command to store the obtained planned path.

The other two IPCs (indicated by 192.168.1.200:50000 and 192.168.1.50:50000 respectively) can communicate with the robot in a similar way. The procedure is not repeated here.

A FANUC robot provides 8 ports in system settings, as shown in the following figure. When you use an undefined port in the MM_INIT_SKT command, you need to restart the controller for the changes to take effect. Otherwise, the robot will be unable to communicate with the vision system and an error will be reported.

sample21 undefinde

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.