Standard Interface Functions

This section describes standard interface functions used in Mitsubishi MC communications between a KEYENCE PLC and Mech-Mind Vision System. The PLC (the client) sends functions to Mech-Mind Vision System (the server), and Mech-Mind Vision System returns the processed data to the PLC.

send receive

Before you call the functions, take note of the following items:

  • Unit of data:

    • The unit of joint positions is degree (°).

    • A robot’s flange pose or TCP consists of the position and pose. The position is represented in XYZ coordinates and is measured in millimeters (mm); the pose is represented in Euler angles and is measured in degrees (°).

  • Vision point and waypoint:

    • Vision point: An object recognized by Mech-Vision. A vision point has information including the object pose, label, velocity, dimensions, and custom data.

    • Waypoint: Each point that the robot reaches when moving along the planned path. A waypoint has information including the robot pose, label, motion type, and velocity. Waypoints can be divided into two categories:

      • Vision Move waypoint: Waypoint corresponding to the Vision Move Step.

      • Non-Vision Move waypoints, which refer to the waypoints corresponding to Move-type Steps other than the Vision Move Step.

Run Mech-Vision Project

Function

This function triggers the Mech-Vision project to run. When the Mech-Vision project is running, the vision system triggers the camera to capture images and then process the returned images with algorithms to produce a series of vision points or waypoints.

  • Vision point: An object recognized by Mech-Vision. A vision point has information including the object pose, label, velocity, dimensions, and custom data.

  • Waypoint: Each point that the robot reaches when moving along the planned path. A waypoint has information including the robot pose, label, motion type, and velocity.

Calling Sequence

Modules

cmd1

Input Parameters

Vision_Proj_Num

This parameter specifies the Mech-Vision project ID. The data type is INT. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

Req_Pose_Num

This parameter specifies the expected number of vision points or waypoints to be obtained from the Mech-Vision project. The data type is INT. Value range: 0 to the largest positive integer.

If the Mech-Vision project has a Path Planning Step, this parameter specifies the expected number of waypoints. Otherwise, it specifies the expected number of vision points.
  • 0: Obtain all vision points or waypoints from the Mech-Vision project.

  • A positive integer: Obtain the specific number of vision points or waypoints from the Mech-Vision project.

    • If the total amount of vision points or waypoints output by the Mech-Vision project is smaller than the parameter value, this function will obtain the number of all vision points or waypoints.

    • If the total amount of vision points or waypoints output by the Mech-Vision project is larger than or equal to the parameter value, this function will obtain the number of vision points or waypoints as specified by this parameter.

Robot_Pose_Type

This parameter specifies the way in which the real robot pose is sent to the Mech-Vision project. The data type is INT. Valid values: 0, 1, 2, and 3. The following table describes the details.

Robot_Joint_Position

This parameter specifies the joint positions of the robot. The data type is ARRAY[0..5] OF REAL.

Robot_Flange_Pose

This parameter specifies the flange pose of the robot. The data type is ARRAY[0..5] OF REAL.

The following table explains the relationship among the Robot_Pose_Type, Robot_Joint_Position, and Robot_Flange_Pose parameters.

Robot_Pose_Type Robot_Joint_Position Robot_Flange_Pose Description Applicable scenario

0

0,0,0,0,0,0

0,0,0,0,0,0

The function does not send the robot pose to the Mech-Vision project.

This setting is recommended when the camera is mounted in the Eye To Hand method. If the Path Planning Step is used in the Mech-Vision project, the start point of the planned path will be the Home point set in the path planning tool.

1

Current joint positions of the robot

Robot’s current flange pose

The current joint positions and flange pose of the robot must be input to the Mech-Vision project.

This setting is recommended when the camera is mounted in the Eye In Hand method. Applicable for most robot types except gantry robots.

2

0,0,0,0,0,0

Robot’s current flange pose

The robot flange pose must be input to the Mech-Vision project.

This setting is recommended when the camera is mounted in the Eye In Hand method. The robot has the flange pose but no joint positions, such as a gantry robot.

3

Joint positions of the start point of the planned path

0,0,0,0,0,0

This function sends custom joint positions to the Mech-Vision project.

This setting is recommended when the camera is mounted in the Eye To Hand method, and the Mech-Vision project contains the Path Planning Step, whose start point needs to be set at the robot side.

Start_Vis

This parameter triggers the Mech-Vision project to start when a rising edge occurs. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Vision_Proj_Num_O

This parameter indicates the Mech-Vision project ID. The data type is INT.

Req_Pose_Num_O

This parameter indicates the expected number of vision points or waypoints that are returned by the Mech-Vision project. The data type is INT. 0 indicates that all vision points or waypoints are obtained from the Mech-Vision project.

Robot_Pose_Type_O

This parameter indicates the way in which the real robot pose is sent to the Mech-Vision project. The data type is INT. Valid values: 0, 1, 2, and 3.

Joint_Position_O

This parameter indicates the joint positions of the robot. The data type is ARRAY[0..5] OF REAL.

Flange_Pose_O

This parameter indicates the flange pose of the robot. The data type is ARRAY[0..5] OF REAL.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 1102. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

cmd2

When Camera_User.Step_Num is set to 2 and Camera_User.Start_Vis is at the rising edge, the PLC triggers Mech-Vision project No.1 to run and expects Mech-Vision project No.1 to return all vision points or waypoints. At the same time, the PLC sends the current joint positions and flange pose of the robot to Mech-Vision.

Get Vision Result

Function

This function obtains vision result, namely, a series of vision points, from Mech-Vision. The object pose of the vision point (namely, the output of the poses port of the Output Step) will be automatically converted to the robot’s TCP by the vision system. The process is as follows.

get tcp
  1. Convert the object pose from a quaternion to Euler angles.

  2. Rotate the object’s pose around the X-axis by 180° to orient its Z-axis downward.

    convert tcp

Calling Sequence

This function should be called after Run Mech-Vision Project.

Modules

cmd3

Input Parameters

Vision_Proj_Num

This parameter specifies the Mech-Vision project ID. The data type is INT. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

Get_VisData

This parameter triggers the vision result to be obtained at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Vision_Proj_Num_O

This parameter indicates the Mech-Vision project ID. The data type is INT.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 1100. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

By default, after the robot sends this command, the vision system returns the result in 10 seconds. If the vision system fails to return any result in 10 seconds, a timeout error code is returned. To modify the default timeout period as needed, go to Robot and Communication > Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision.

set vis time

Status_of_Pose_Sent

This parameter is set to 1, which indicates that the input pose data is new. The data type is INT. After the PLC reads the pose data, please reset this parameter.

Number_of_Pose_Sent

This parameter stores the number of vision points returned by Mech-Vision. The data type is INT.

Target_Pose

This parameter indicates the poses of all vision points in the obtained vision result. The poses are TCPs. The data type is ARRAY[0..39,0..5] OF REAL.

Target_Label

This parameter indicates the labels of all vision points in the obtained vision result. Labels and poses are one-to-one paired. The data type is ARRAY[0..39] OF INT.

Example

cmd4

When Camera_User.Step_Num is set to 4 and Camera_User.Get_VisData is at the rising edge, this example obtains the vision result from Mech-Vision project No. 1.

Switch Mech-Vision Parameter Recipe

Function

This function triggers Mech-Vision to switch the parameter recipe used by the project. The image below shows how to manually switch the parameter recipe for a Mech-Vision project. For details about parameter recipes, see the parameter recipe guide.

set recipe

Calling Sequence

This function should be called before Run Mech-Vision Project.

Modules

cmd5

Input Parameters

Vision_Proj_Num

This parameter specifies the Mech-Vision project ID. The data type is INT. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

Vision_Recipe_Num

This parameter specifies the parameter recipe ID in the Mech-Vision project. The data type is INT. For information about how to view the parameter recipe ID, see View the Parameter Recipe ID.

Switch_Recipe

This parameter triggers the switch of parameter recipe in Mech-Vision when the rising edge occurs. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Vision_Proj_Num_O

This parameter indicates the Mech-Vision project ID. The data type is INT.

Vision_Recipe_Num_O

This parameter indicates the parameter recipe ID in the Mech-Vision project. The data type is INT.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 1107. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

cmd6

When Camera_User.Step_Num is set to 8 and Camera_User.Switch_Recipe is at the rising edge, this example switches the parameter recipe used to No.2 in Mech-Vision project No.1.

Get Planned Path in Mech-Vision

Function

This function obtains the path planned by the Mech-Vision project as a series of waypoints. The path is planned by the path planning tool, which you may enter by clicking Open the editor as shown in the image below. For details about Path Planning, see Path Planning.

Set the Port Type parameter of the Output Step in Mech-Vision to Predefined (robot path).
get plan path step

Calling Sequence

This function should be called after Run Mech-Vision Project.

Modules

cmd7

Input Parameters

Vision_Proj_Num

This parameter specifies the Mech-Vision project ID. The data type is INT. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

Request_Pose_Type

This parameter specifies the type of waypoint poses to be obtained. The data type is INT. Valid values: 1 and 2.

  • 1: Joint positions.

  • 2: TCP.

Get_VisData

This parameter triggers the path planned by Mech-Vision to be obtained at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Vision_Proj_Num_O

This parameter indicates the Mech-Vision project ID. The data type is INT.

Request_Pose_Type_O

This parameter indicates the pose type of the obtained waypoints. The data type is INT. 1 indicates joint positions, and 2 indicates TCP.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 1103. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

By default, after the robot sends this command, the vision system returns the result in 10 seconds. If the vision system fails to return any result in 10 seconds, a timeout error code is returned. To modify the default timeout period as needed, go to Robot and Communication > Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision.

set vis time

Status_of_Pose_Sent

This parameter is set to 1, which indicates that the input pose data is new. The data type is INT. After the PLC reads the pose data, please reset this parameter.

Number_of_Pose_Sent

This parameter stores the number of waypoints returned by the vision system. The data type is INT. By default, the vision system can send 20 waypoints at most. As such, the maximum default value of this parameter is 20. To modify the default maximum number of poses to obtain each time as needed, go to Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision. The upper limit is 30.

set number
Before you call Get Planned Path in Mech-Vision, set Req_Pose_Num of Run Mech-Vision Project to 0 to reduce the number of Get Planned Path in Mech-Vision calls. If Req_Pose_Num of Run Mech-Vision Project is set to 1, only one waypoint is obtained each time you call Get Planned Path in Mech-Vision. You need to call Function 105 for several times to obtain all waypoints.

Index_of_Vision_Picking_Point

The position ID of the Vision Move waypoint corresponding to the Vision Move step of the path planning tool in the path. The data type is INT. If the waypoint does not exist in the path, the petameter value is 0.

If the planned path consists of the following waypoints in sequence: Fixed-Point Move_1, Fixed-Point Move_2, Vision Move, and Fixed-Point Move_3, the position ID of the Vision Move waypoint is 3.

Target_Pose

This parameter indicates the poses of all waypoints in the obtained planned path. The poses are TCPs or joint positions, depending on the Request_Pose_Type value. The data type is ARRAY[0..39,0..5] OF REAL.

Target_Label

This parameter indicates the labels of all waypoints in the obtained planned path. Labels and poses are one-to-one paired. The data type is ARRAY[0..39] OF INT.

Target_Tool_ID

This parameter indicates the tool IDs of all waypoints in the obtained planned path. The tool IDs and poses are one-to-one paired. The data type is ARRAY[0..39] OF INT.

Example

cmd8

When Camera_User.Step_Num is set to 10 and Camera_User.Get_VisData is at the rising edge, this example obtains the planned path from Mech-Vision project No. 1. The waypoints are represented in joint positions.

Get Gripper DO List

Function

This function obtains the control signal list for the multi-section vacuum gripper from the Mech-Vision or Mech-Viz project.

You should configure DO signals before calling this function.

  • Configure DO signals in the Mech-Vision project

    Select the Path Planning Step, click Open the editor in the step parameter panel, and then double-click the name of the robot tool. In the pop-up window, select Depalletizing vacuum gripper for Tool type, click Configure depalletizing vacuum gripper, and then configure DO signals according to needs.

    sucker vis
  • Configure DO signals and the Set DO Step in the Mech-Viz project

    In Mech-Viz, double-click the tool name, select Depalletizing vacuum gripper for Tool type, click Configure depalletizing vacuum gripper, and then configure the DO signal values according to needs.

    sucker viz

Calling Sequence

This function must be called before the Get Planned Path in Mech-Vision or Get Planned Path in Mech-Viz function. This means that the PLC must obtain the planned path and then obtain gripper DO signals of the Vision Move waypoint.

Modules

cmd9

Input Parameters

Vision_Proj_Num

This parameter specifies the source of the DO signal list. The data type is INT. Value range: 0 to the largest positive integer.

  • 0: Get DO signal list from Mech-Viz.

  • A positive integer: Get DO signal list from Mech-Vision. The positive integer is the Mech-Vision project ID.

Depalletize_Tool_Section_Count

This parameter indicates the number of vacuum gripper sections. The data type is INT.

Get_DoList

This parameter triggers gripper DO signals to be obtained at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Vision_Proj_Num_O

This parameter indicates the source of the DO signal list. The data type is INT.

Depalletize_Tool_Section_Count_O

This parameter indicates the number of vacuum gripper sections. The data type is INT.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function successfully obtained the DO signal list of the Mech-Viz project, the status code is 2102. If the DO signal list is successfully obtained from Mech-Vision, the status code is 1106. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

DO_LIST

This parameter indicates the 64 DO signals returned by this function. The data type is ARRAY[0..63] OF INT.

The DO signals returned by this function vary based on the deployed project.

  • Gripper DO signals planned by the Mech-Vision project

    • Under Global Configuration of the path planning tool, if Plan all vision results is disabled, this function returns 64 gripper DO signals that are planned in this round. Valid DO signals are non-negative integers ranging from 0 to 999. Invalid DO signals are -1, which serves as a placeholder.

      plan all vis off

      For example, valid DO signals in the table below are 1, 3, 5, and 6, which means that the robot will set the values of these DO signals to ON.

      1st

      2nd

      3rd

      4th

      5th

      6th

      7th

      8th

      63rd

      64th

      1

      3

      5

      6

      -1

      -1

      -1

      -1

      -1

      -1

    • Under Global Configuration of the path planning tool, if Plan all vision results is enabled, Mech-Vision can perform multiple rounds of planning based on the same vision result. The 64 gripper DO signals returned by this function are obtained during all rounds of planning. In this case, you can use the number of vacuum gripper sections to differentiate the gripper DO signals obtained during each round of planning.

      plan all vis on

      For example, if the number of vacuum gripper sections is 4 and the function returns 64 DO signals in total, each 4 DO signals are multi-section vacuum gripper signals obtained during each round of planning.

      First round of planning

      Second round of planning

      16th round of planning

      1st

      2nd

      3rd

      4th

      5th

      6th

      7th

      8th

      61st

      62nd

      63rd

      64th

      1

      3

      4

      -1

      1

      4

      -1

      -1

      -1

      -1

      -1

      -1

  • Gripper DO signals planned by the Mech-Viz project

    • If Reuse Vision Result is not selected for the Vision Move Step, this function returns 64 gripper DO signals that are planned during this round. Valid DO signals are non-negative integers ranging from 0 to 999. Invalid DO signals are -1, which serves as a placeholder.

      vision move off

      For example, valid DO signals in the table below are 1, 3, 5, and 6, which means that the robot will set the values of these DO signals to ON.

      1st

      2nd

      3rd

      4th

      5th

      6th

      7th

      8th

      63rd

      64th

      1

      3

      5

      6

      -1

      -1

      -1

      -1

      -1

      -1

    • If Reuse Vision Result is selected for the Vision Move Step and the Vision Move Step is used in a loop, Mech-Viz can perform multiple rounds of planning based on the same vision result. The 64 gripper DO signals returned by this function are obtained during all rounds of planning. In this case, you can use the number of vacuum gripper sections to differentiate the gripper DO signals obtained during each round of planning.

      vision move on

      For example, if the number of vacuum gripper sections is 4 and the function returns 64 DO signals in total, each 4 DO signals are multi-section vacuum gripper signals obtained during each round of planning.

      First round of planning

      Second round of planning

      16th round of planning

      1st

      2nd

      3rd

      4th

      5th

      6th

      7th

      8th

      61st

      62nd

      63rd

      64th

      1

      3

      4

      -1

      1

      4

      -1

      -1

      -1

      -1

      -1

      -1

Example

cmd10

When Camera_User.Step_Num is set to 26 and Camera_User.Get_DoList is at the rising edge, this example obtains the DO signal list from Mech-Viz and stores the list in DO_LIST.

Get Mech-Vision Custom Data

Function

This function obtains data from the custom port(s) of the Output Step in Mech-Vision. One function call saves all port data of the Output Step to the specified register.

Select the Output step, set Port Type to Custom, and then click Open the editor to go to the custom port configuration window. The Customized Keys section of the window displays custom port names, such as customeData1 and customeData2, as shown in the following figure.

  1. Data output from Predefined Keys, such as poses, labels, sizes, offsets, is not custom data.

  2. You must set Port Type of the Output step to Custom and select the poses port in the Predefined Keys section in Mech-Vision.

custom data
The number of custom ports cannot exceed 10. The obtained custom data is sorted in a case-sensitive alphabetical order of ports.

Calling Sequence

This function should be called after Run Mech-Vision Project.

Modules

cmd11

Input Parameters

Vision_Proj_Num

This parameter specifies the Mech-Vision project ID. The data type is INT. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

Get_VisData

This parameter triggers custom data of Mech-Vision to be obtained at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Vision_Proj_Num_O

This parameter indicates the Mech-Vision project ID. The data type is INT.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 1100. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Status_of_Pose_Sent

This parameter is set to 1, which indicates that the input pose data is new. The data type is INT. After the PLC reads the pose data, please reset this parameter.

Number_of_Pose_Sent

This parameter stores the number of vision points returned by Mech-Vision. The data type is INT.

Target_Pose

This parameter indicates the poses of all vision points in the obtained vision result. The poses are TCPs. The data type is ARRAY[0..39,0..5] OF REAL.

Target_Label

This parameter indicates the labels of all vision points in the obtained vision result. Labels and poses are one-to-one paired. The data type is ARRAY[0..39] OF INT.

Custom_Vision_Output

This parameter indicates the custom data of each vision point in the obtained vision result. Custom data and poses are one-to-one paired. The data type is ARRAY[0..39,0..9] OF REAL.

Example

cmd12

When Camera_User.Step_Num is set to 32 and Camera_User.Get_VisData is at the rising edge, this example obtains the custom data from Mech-Vision project No. 1.

Run Mech-Viz project

Function

This function triggers the Mech-Viz project to run. Mech-Viz plans the robot’s motion path based on the vision result output by Mech-Vision.

Right-click the project name in the project resource panel in Mech-Viz and select Autoload Project.

Modules

cmd13

Input Parameters

Robot_Pose_Type

This parameter specifies the way in which the real robot pose is sent to the Mech-Viz project. Valid values: 0, 1, and 2. The following table describes the details. The data type is INT.

Robot_Joint_Position

This parameter specifies the joint positions of the robot. The data type is ARRAY[0..5] OF REAL.

Robot_Flange_Pose

This parameter specifies the flange pose of the robot. The data type is ARRAY[0..5] OF REAL.

The following table explains the relationship among the Robot_Pose_Type, Robot_Joint_Position, and Robot_Flange_Pose parameters.

Robot_Pose_Type Robot_Joint_Position Robot_Flange_Pose Description Applicable scenario

0

0,0,0,0,0,0

0,0,0,0,0,0

The function does not need to send the robot pose to the Mech-Viz project. The simulated robot in Mech-Viz moves from the initial pose (joint positions = [0, 0, 0, 0, 0, 0]) to the first waypoint.

This setting is recommended when the camera is mounted in the Eye To Hand method.

1

Current joint positions of the robot

Robot’s current flange pose

In this function, the robot sends its current joint positions and flange pose to the Mech-Viz project. The simulated robot in Mech-Viz moves from the input joint positions to the first waypoint.

This setting is recommended when the camera is mounted in the Eye In Hand method.

2

Joint positions of the start point of the planned path

0,0,0,0,0,0

In this function, the robot sends the joint positions of a teach point (the custom joint positions), instead of the current joint positions, to the Mech-Viz project. The Mech-Viz project uses the input joint positions to plan the next path in advance while the robot is not in the camera capture region, as shown below. The simulated robot in Mech-Viz moves from the input joint positions to the first waypoint.

This setting is recommended when the camera is mounted in the Eye To Hand method.

If the camera is mounted in the Eye To Hand method, option 2 recommended for Robot_Pose_Type. Why?

In the Eye To Hand method, the camera can perform image capturing for the next round of path planning before the robot returns to the image capture region and picking region, thus shortening the cycle time. The image below demonstrates how a robot works in the placing region.

If Robot_Pose_Type is set to 1, the robot will send the current pose to Mech-Viz. It is possible that the real robot moves to other positions before reaching the first waypoint. However, the simulated robot moves directly to the first waypoint of the Mech-Viz project from the pose sent by the robot. Consequently, there may be a mismatch between the paths of the real robot and simulated robot. This mismatch can potentially lead to unpredicted safety hazards, especially if collision is detected in the path of the simulated robot.

On the other hand, if Robot_Pose_Type is set to 2, the robot will send the image-capturing pose set by teaching to Mech-Viz. Thus, the real robot can trigger the next round of path planning in Mech-Viz when the real robot is in the image-capturing region and the cycle time can be shortened.

In conclusion, Robot_Pose_Type should be set to 2 for projects in the Eye To Hand method.

robot example

Start_Viz

This parameter triggers the Mech-Viz project to run at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Robot_Pose_Type_O

This parameter indicates the way in which the real robot pose is sent to the Mech-Vision project. The data type is INT. Valid values: 0, 1, 2, and 3.

Joint_Position_O

This parameter indicates the joint positions of the robot. The data type is ARRAY[0..5] OF REAL.

Flange_Pose_O

This parameter indicates the flange pose of the robot. The data type is ARRAY[0..5] OF REAL.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 2103. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

cmd14

When Camera_User.Step_Num is set to 16 and Camera_User.Start_Viz is at the rising edge, this example runs the corresponding Mech-Viz project and sends the current joint positions and flange pose of the robot to Mech-Viz.

Stop Mech-Viz Project

Function

This function stops the Mech-Viz project.

Calling Sequence

This function should be called after Run Mech-Viz project.

Modules

cmd15

Input Parameters

Stop_Viz

This parameter triggers the Mech-Viz project to stop at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 2104. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

cmd16

When Camera_User.Step_Num is set to 18 and Camera_User.Stop_Viz is at the rising edge, this example stops the Mech-Viz project.

Set the exit port for the Branch by Msg Step in Mech-Viz

Function

This function sets the exit port for the Branch by Msg Step. When the next Step is a Branch by Msg Step, the Mech-Viz project will wait for this function to specify the exit port.

set branch

Calling Sequence

This function should be called after Run Mech-Viz project.

Modules

cmd17

Input Parameters

Branch_Name

This parameter specifies the Step ID of the Branch by Msg Step. The data type is INT. The value is a positive integer. The Step ID is displayed in the Step parameter panel. For example, the Step ID of the Step in the image above is 1.

Branch_Exit_Port

This parameter specifies the exit port ID of the Branch by Msg Step. The data type is INT. The value is a positive integer. When the parameter value is set to N, the Mech-Viz project exits from the port with an ID of N-1 of the Branch by Msg Step.

Set_Branch

This parameter triggers the exit port of the Branch by Msg Step to be set in the Mech-Viz project at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Branch_Name_O

This parameter indicates the Step ID of the Branch by Msg Step. The data type is INT.

Branch_Exit_Port_O

This parameter indicate the exit port of the Branch by Msg Step. The data type is INT.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 2105. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

cmd18

When Camera_User.Step_Num is set to 22 and Camera_User.Set_Branch is at the rising edge, the Mech-Viz project takes port 0 of the Branch by Msg Step No.1.

Set Current Index in Mech-Viz

Function

This function sets the value of the Current Index parameter of index-type Steps. Index-type Steps are Steps that include the Index section, which include Move by Grid, Move by List, Custom Pallet Pattern, and Predefined Pallet Pattern.

set index

Calling Sequence

Index-type Steps are often preceded by a Branch by Msg Step. The robot should call functions in this order: Run Mech-Viz project, Set Current Index in Mech-Viz, and Set the exit port for the Branch by Msg Step in Mech-Viz. This is to ensure that Mech-Viz has enough time to set the Current Index value.

Modules

cmd19

Input Parameters

Index_Name

This parameter specifies the Step ID of the Index-type Step. The data type is INT. The value is a positive integer. The Step ID is displayed in the Step parameter panel. For example, the Step ID of the Step in the image above is 3.

Index_Counter

This parameter specifies the current index for a Index-type Step. The data type is INT. The value is a positive integer. When this parameter value is set to N, the current index of the corresponding Step is N-1.

Set_Index

This parameter triggers the Current Index value to be set in the Mech-Viz project at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Index_Name_O

This parameter indicates the Step ID of the index-type Step. The data type is INT.

Index_Counter_O

This parameter indicates the Current Index value of the index-type Step. The data type is INT.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 2106. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

cmd20

When Camera_User.Step_Num is set to 20 and Camera_User.Set_Index is at the rising edge, this example sets the Current Index value to 3 for the Step whose Step ID is 5 in the Mech-Viz project.

Get Planned Path in Mech-Viz

Function

This function obtains the path planned by the Mech-Viz project as a series of waypoints.

Waypoint: Each point that the robot reaches when moving along the planned path. A waypoint has information including the robot pose, label, motion type, and velocity. Waypoints can be divided into two categories:

  • Vision Move waypoint: Waypoint corresponding to the Vision Move Step.

  • Non-Vision Move waypoints, which refer to the waypoints corresponding to Move-type Steps other than the Vision Move Step.

Calling Sequence

This function should be called after Run Mech-Viz project.

Modules

cmd21

Input Parameters

Request_Pose_Type

This parameter specifies the type of waypoint poses to be obtained. The data type is INT. Valid values: 1 and 2.

  • 1: Joint positions.

  • 2: TCP.

Get_VizData

This parameter triggers the path planned by Mech-Viz to be obtained at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Request_Pose_Type_O

This parameter indicates the pose type of the obtained waypoints. The data type is INT. 1 indicates joint positions, and 2 indicates TCP.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 2100. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

By default, after the robot sends this command, the vision system returns the result in 10 seconds. If the vision system fails to return any result in 10 seconds, a timeout error code is returned. To modify the default timeout period as needed, go to Robot and Communication > Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision.

set viz time

Status_of_Pose_Sent

This parameter is set to 1, which indicates that the input pose data is new. The data type is INT. After the PLC reads the pose data, please reset this parameter.

Number_of_Pose_Sent

This parameter stores the number of waypoints that are returned by the vision system. By default, the vision system sends no more than 20 waypoints at a time. Therefore, the maximum default value of this parameter is 20. To modify the default maximum number of poses to obtain each time as needed, go to Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision. The upper limit is 30.

set number

Index_of_Vision_Picking_Point

The position ID of the Vision Move waypoint (i.e., the waypoint corresponding to the Vision Move step in the Mech-Viz project) in the path. The data type is INT. If the waypoint does not exist in the path, the petameter value is 0.

If the planned path consists of the following waypoints in sequence: Fixed-Point Move_1, Fixed-Point Move_2, Vision Move, and Fixed-Point Move_3, the position ID of the Vision Move waypoint is 3.

Target_Pose

This parameter indicates the poses of all waypoints in the obtained planned path. The poses are TCPs or joint positions, depending on the Request_Pose_Type value. The data type is ARRAY[0..39,0..5] OF REAL.

Target_Label

This parameter indicates the labels of all waypoints in the obtained planned path. Labels and poses are one-to-one paired. The data type is ARRAY[0..39] OF INT.

Target_Tool_ID

This parameter indicates the tool IDs of all waypoints in the obtained planned path. The tool IDs and poses are one-to-one paired. The data type is ARRAY[0..39] OF INT.

Example

cmd22

When Camera_User.Step_Num is set to 24 and Camera_User.Get_VizData is at the rising edge, this example obtains the planned path from the Mech-Viz project. The waypoints are represented in TCP.

Input Object Dimensions to Mech-Vision Project

Function

This function dynamically inputs object dimensions into the Mech-Vision project. The object dimensions are the values of the Box Size Settings parameters in the Read Object Dimensions Step.

read object dimensions

Calling Sequence

This function should be called before Run Mech-Vision Project.

Modules

cmd23

Input Parameters

Vision_Proj_Num

This parameter specifies the Mech-Vision project ID. The data type is INT. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

External_Input_Box_Dimension

This parameter inputs the length, width, and height of the object to the Mech-Vision project. The length, width, and height are measured in millimeters (mm). These values are read by the Read Object Dimensions Step and set for the parameters Length on X-axis, Length on Y-axis and Length on Z-axis. The data type is ARRAY[0..2] OF REAL.

Set_Box_Dimension

This parameter triggers the object dimensions to be input to the Mech-Vision project at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Vision_Proj_Num_O

This parameter indicates the Mech-Vision project ID. The data type is INT.

External_Input_Box_Dimension_O

This parameter indicates the object dimensions input to the Mech-Vision project. The data type is ARRAY[0..2] OF REAL.

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 1108. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

cmd24

When Camera_User.Step_Num is set to 6 and Camera_User.Set_Box_Dimension is at the rising edge, this example sets External_Input_Box_Dimension to the object dimensions read by the Read Object Dimensions Step in the Mech-Vision project.

Get Message from Notify Step

Function

When the Mech-Vision project or Mech-Viz project is executing the Notify Step, the vision system returns the message predefined in the Notify Step.

When the Notify Step is executed in the Mech-Vision or Mech-Viz project, the message remains in the buffer of the vision system for only one second. Therefore, you should consider the timing of calling this function to ensure successful message retrieval. Additionally, after receiving the message, the PLC should clear the data in the register.

Before sending this function, complete the following settings for the Notify Step:

  • For a Notify Step in the Mech-Vision project:

    1. Connect the Notify Step to the right side of another Step. The Output Step is used in the example in the image below.

      notify 1
    2. Select Trigger Control Flow Given Output in the parameter panel of the Output Step.

      notify 5
    3. In the parameter panel of the Notify Step, enter Standard Interface Notify (the value cannot be modified) for Service Name. Enter a positive integer for Message, for example, 1001.

      notify 2
  • For a Notify Step in the Mech-Viz project:

    1. Connect the Notify Step to a proper Step in the workflow.

      notify 3
    2. In the parameter panel of the Notify Step, select Standard Interface. Enter a positive integer for Message, for example, 1000.

      notify 4

Calling Sequence

This function should be called after Run Mech-Vision Project or Run Mech-Viz project.

Modules

cmd25

Input Parameters

Get_Notify

This parameter triggers the message of the Notify Step to be obtained at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Notify

This parameter stores the message from the Notify Step. Only integer messages are supported at the moment. The data type is INT.

Example

For example, the message set in the Notify Step is 777, and the PLC is obtaining a message in the automatic mode.

cmd26

In this example, whenCamera_User.Step_Num is set to 3 in the automatic mode, the value of MM_Camera.Notify is not 777. After MM_Get_Custom_Notify is enabled when the Camera_User.Get_Notify variable is at the rising edge, the program retrieves the message from the Notify Step. If the message retrieval was successful, the value of MM_Camera.Notify changes to 777. If the value remains unchanged, the PLC will prompt an error after 3 seconds.

Get Project Status

Function

This function checks if the Mech-Vision project is ready.

Modules

cmd27

Input Parameters

Get_Status

This parameter checks if the Mech-Vision project is ready at the rising edge. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Output Parameters

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Returned data of the MM_Camera global variable

Status_Code

This parameter stores the status code of this function. The data type is INT. If the function is successfully executed, the status code is 1101. If a command fails to be run, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

cmd28

When Camera_User.Step_Num is set to 28 and Camera_User.Get_VisData is at the rising edge, this example checks whether the Mech-Vision project is ready.

Clear Data

Function

This function clears the obtained poses, labels, and tool IDs.

Modules

cmd29

Input Parameters

Start_Empty

This parameter triggers the obtained poses, labels, and tool IDs to be cleared. This parameter will take effect when it is set. The data type is BOOL.

Trigger_Acknowledge

This parameter indicates whether the Command_Trigger signal successfully triggers the vision system. The data type is INT. 1 indicates that the vision system is successfully triggered, and 0 indicates that the Command_Trigger signal is not received.

Input/Output Parameters

Target_Pose

This parameter indicates the poses of the obtained waypoints or vision points. The data type is ARRAY[0..39,0..5] OF REAL.

Target_Label

This parameter indicates the labels of the obtained waypoints or vision points. The data type is ARRAY[0..39] OF INT.

Target_Tool_ID

This parameter indicates the tool IDs of the obtained waypoints or vision points. The data type is ARRAY[0..39] OF INT.

Output Parameters

Command

This parameter indicates the function code that will be automatically assigned. The data type is INT.

Command_Trigger

This parameter indicates the function switch that will be automatically triggered. The data type is INT.

Example

cmd30

When Camera_User.Step_Num is set to 12 and Camera_User.Start_Empty is set, this example clears MM_Camera.Target_Pose, MM_Camera.Target_Label, and MM_Camera.Target_Tool_ID.

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.