Example Program 15: MM_S15_Viz_GetDoList

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

After obtaining the picking path and DO signals, the robot can perform picking by moving to the picking waypoint and setting the DO signals in a loop. This example program is used in depalletizing scenarios, and the tool used by the robot is a multi-section vacuum gripper.

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

Project

Mech-Vision project 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_S15_Viz_GetDoList example program.

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

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

sample15

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

Obtain the planned path

  23:  !get planned path ;
  24:  CALL MM_GET_PLNDT(0,3,51,52,53) ;
  • MM_GET_PLNDT: The command to obtain the planned path. The Vision Move waypoints obtained by this command contain Vision Move data and custom data (if any) in addition to poses, while Vision Move waypoints obtained by the MM_GET_VIZDATA command do not contain Vision Move data or custom data.

  • 0: Obtain the planned path from Mech-Viz.

  • 3: The format of the data that is expected to be returned, which is pose (in joint positions), motion type, tool ID, velocity, Mech-Viz Vision Move data, element 1 in custom data, ..., element N in custom data.

  • 51: The numeric register R[51], which stores the number of waypoints returned by the vision system.

  • 52: The numeric register R[52], which stores the sequence number of the Vision Move waypoint (picking waypoint) in the path.

  • 53: The numeric register R[53], which stores the command execution status code.

Obtain the gripper DO list

  29:  !get gripper control signal list ;
  30:  CALL MM_GET_DL(0,0) ;
  • MM_GET_DL: The command to obtain the gripper DO list.

  • First 0: Specify the source of the DO signals, i.e., obtain the multi-section gripper DO signals from Mech-Viz.

  • Second 0: Obtain all planned gripper DO signals.

Store the planned path

  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) ;
  • MM_GET_PLJOP: The command to store Vision Move data or custom data.

  • 1: Store the first waypoint.

  • 3: The value of the second parameter in the MM_GET_PLNDT command.

  • 60: The position register PR[60], which stores the pose of the first waypoint.

  • 61: The numeric register R[61], which stores the motion type of the first waypoint.

  • 62: The numeric register R[62], which stores the tool ID of the first waypoint.

  • 63: The numeric register R[63], which stores the velocity of the first waypoint.

  • 64: Numeric registers starting from R[64]. The custom data for the first waypoint will be stored sequentially in registers starting from R[64].

  • 70: Numeric registers starting from R[70]. The Vision Move data for the first waypoint will be stored sequentially in registers starting from R[70].

The entire statement “CALL MM_GET_PLJOP(1,3,60,61,62,63,64,70)” indicates that the pose, motion type, tool ID, velocity, custom data, and Vision Move data for the first waypoint are stored in the specified registers.

In this example, the path planned by Mech-Viz consists of three waypoints: the first waypoint is the approach waypoint of picking (PR[60]), the second waypoint is the picking waypoint (PR[61]), and the third waypoint is the departure waypoint of picking (PR[62]). Please store the planned path based on the actual Mech-Viz project.

Move to the picking waypoint to perform picking

  41:  !move to picking waypoint ;
  42:J PR[61] 10% FINE    ;
  43:  !add object grasping logic here ;
  44:  PAUSE ;
  45:  !set gripper control signal ;
  46:  CALL MM_SET_DL(0) ;
  • MM_SET_DL: The command to set the gripper DO list.

  • 0: Set all planned gripper DO signals.

The above statement indicates that the robot moves to the picking waypoint (PR[61]) and then runs the MM_SET_DL command to set gripper DO signals to perform picking.

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.