Example Program 18: MM_S18_Viz_GetUserData

Program Introduction

Description

When the robot obtains the picking path, the robot also obtains the custom output data from the Mech-Vision project.

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_S18_Viz_GetUserData path.

Project

Mech-Vision project (one or more custom ports need to be added to the Output Step) and Mech-Viz project (the tool is a depalletizing vacuum gripper)

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_S18_Viz_GetUserData example program.

Compared with the MM_S15_Viz_GetDoList example program, this example program contains only the following modification (the code of this modification is bolded). As such, only the modification is described in the following part. For information about the parts of MM_S18_Viz_GetUserData that are consistent with those of MM_S15_Viz_GetDoList, see Example Program 15: MM_S15_Viz_GetDoList.
   1:  !-------------------------------- ;
   2:  !FUNCTION: trigger Mech-Viz ;
   3:  !project, then get planned path ;
   4:  !and get custom data from ;
   5:  !Mech-Vision using 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:  !save received custom data of ;
  38:  !2nd point ;
  39:  R[10]=R[94]    ;
  40:  R[11]=R[95]    ;
  41:  R[12]=R[96]    ;
  42:  !follow the planned path to pick ;
  43:  !move to approach waypoint ;
  44:  !of picking ;
  45:J PR[60] 50% FINE    ;
  46:  !move to picking waypoint ;
  47:J PR[61] 10% FINE    ;
  48:  !add object grasping logic here ;
  49:  PAUSE ;
  50:  !set gripper control signal ;
  51:  CALL MM_SET_DL(0)    ;
  52:  !move to departure waypoint ;
  53:  !of picking ;
  54:J PR[62] 50% FINE    ;
  55:  !move to intermediate waypoint ;
  56:  !of placing ;
  57:J P[3] 50% CNT100    ;
  58:  !move to approach waypoint ;
  59:  !of placing ;
  60:L P[4] 1000mm/sec FINE Tool_Offset,PR[2]    ;
  61:  !move to placing waypoint ;
  62:L P[4] 300mm/sec FINE    ;
  63:  !add object releasing logic here, ;
  64:  !such as "DO[1]=OFF" ;
  65:  PAUSE ;
  66:  !move to departure waypoint ;
  67:  !of placing ;
  68:L P[4] 1000mm/sec FINE Tool_Offset,PR[2]    ;
  69:  !move back to robot home position ;
  70:J P[1] 100% FINE    ;
  71:  END ;
  72:   ;
  73:  LBL[99:vision error] ;
  74:  !add error handling logic here ;
  75:  !according to different ;
  76:  !error codes ;
  77:  !e.g.: status=2038 means no ;
  78:  !point cloud in ROI ;
  79:  PAUSE ;

The workflow corresponding to the above example program code is shown in the figure below.

sample18

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

Feature Code and description

Store custom data of waypoints

  37:  !save received custom data of ;
  38:  !2nd point ;
  39:  R[10]=R[94]    ;
  40:  R[11]=R[95]    ;
  41:  R[12]=R[96]    ;
In the Mech-Viz project, custom data refers to data output by the custom port(s) of the Output Step in Mech-Vision and then forwarded by Mech-Viz.

The robot obtains the Vision Move and custom data of waypoints by running the MM_GET_PLNDT command, and then saves the Vision Move and custom data of waypoints that are stored in the robot memory to specified registers by running the MM_GET_PLJOP command. In the example, the custom data for the picking waypoint (PR[61]) is stored in registers starting from R[94].

The above code assigns three pieces of custom data of the Vision Move waypoint (picking waypoint) in R[94], R[95], and R[96] to R[10], R[11], and R[12], respectively.

You can define the meaning of R[10], R[11], and R[12]. For example, the values in R[10], R[11], and R[12] could represent the robot’s offsets along the XYZ axes when moving to the picking waypoint.

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.