EtherNet/IP–Allen‑Bradley PLC Functions

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.

Start Mech-Vision Project

This function is used for applications that use Mech-Vision but not Mech-Viz. This function starts the Mech-Vision project that executes image capturing and performs vision recognition.

mc cmd 1

Parameters

Input Parameters

  • Vision_Proj_Num: Mech-Vision project ID, which is the number before the project name in the Project List panel in Mech-Vision.

  • Req_Pose_Num: The number of vision points that Mech-Vision is requested to send, from 0 to 20, where 0 indicates to send all vision points.

  • Robot_Pose_Type: The type of pose of the real robot to input to Mech-Vision. The value range is 0 to 3.

  • Camera_User.Robot_Pose_JPS: Current joint positions of the robot. The data type is one-dimensional Array [0..5] of Real.

  • Camera_User.Robot_Pose_Flange: Current flange pose of the robot. The data type is one-dimensional Array [0..5] of Real.

The following table explains the relationship between Robot_Pose_Type and Camera_User.Robot_Pose_JPS/Camera_User.Robot_Pose_Flange.

Robot_Pose_Type Camera_User.Robot_Pose_JPS Camera_User.Robot_Pose_Flange Description Applicable scenario

0

0, 0, 0, 0, 0, 0

0, 0, 0, 0, 0, 0

No need to input robot pose to Mech-Vision

Project is in the eye-to-hand mode. If the “Path Planning” Step is used in the Mech-Vision project, the planned path starts at the Home point set in the path planning tool.

1

Current joint positions of the robot

Current flange pose of the robot

Robot joint positions and flange pose must be input to Mech-Vision

Project is in the eye-in-hand mode. Applicable to most robots (excluding truss robots).

2

0, 0, 0, 0, 0, 0

Current flange pose of the robot

Robot flange pose must be input to Mech-Vision

Project is in the eye-in-hand mode. The robot has no joint positions and only flange pose (such as truss robots).

3

Joint positions of the start point of the planned path

0, 0, 0, 0, 0, 0

The joint positions of the path start point must be input to Mech-Vision.

Project is in the eye-to-hand mode and the Mech-Vision project contains the “Path Planning” Step, whose start point needs to be set from the robot side.

  • Start_Vision: Trigger the start of the Mech-Vision project at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 1102 will be returned. Otherwise, the corresponding error code will be returned.

Example

When there is a rising edge on the label Camera_User.Start_Vis, the PLC runs Mech-Vision project No.1, asks the project to return vision results, and sends the current joint positions and flange pose of the robot to Mech-Vision.

mc cmd 2

Get Vision Target(s)

This function is called after Function 101 — Start Mech-Vision Project to obtain the vision points output by Mech-Vision and automatically transform the vision points into vision targets.

The transformation process, in which the poses of vision points are transformed into the robot TCP, is as follows:

  • Rotate the poses around their X axes by 180 degrees.

  • Determine whether the definition of the reference frame used by the robot model involves robot base height, and add a vertical offset accordingly.

mc cmd 3

Parameters

Input Parameters

  • Vision_Proj_Num: Mech-Vision project ID, which is the number before the project name in the Project List panel in Mech-Vision.

  • Get_VisData: Obtains the vision target at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 1100 will be returned. Otherwise, the corresponding error code will be returned.

  • Status of Pose Sent: 1 represents that the pose data written in are new. After the PLC reads the pose data, please run the MM_Empty_Target FB to reset the register to 0.

  • Number_of_Pose_Sent: The number of vision targets obtained, from 1 to 20.

  • Target_Pose: The pose of the vision targets in TCP.

  • Target_Label: The label of a single vision target.

Example

When the Camera_User.Get_VisData label is at the rising edge, this example obtains the vision targets from Mech-Vision project No.1.

mc cmd 4

Switch Mech-Vision Recipe

This function switches the parameter recipe used by the Mech-Vision project. It should be executed before Start Mech-Vision Project.

mc cmd 5

Parameters

Input Parameters

  • Vision_Proj_Num: Mech-Vision project ID, which is the number before the project name in the Project List panel in Mech-Vision.

  • Vision_Recipe_Num: The ID of the parameter recipe to switch to in the Mech-Vision project.

  • Switch_Recipe: The signal to switch the parameter recipe at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 1107 will be returned. Otherwise, the corresponding error code will be returned.

Example

When 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.

mc cmd 6

Get Result of Step “Path Planning” in Mech-Vision

After executing Start Mech-Vision Project, this function gets the collision-free planned path output by the “Path Planning” Step in Mech-Vision.

When using this function, set the Port Type parameter of the “Procedure Out” Step in the Mech-Vision project to “Predefined (robot path)”.

Before executing the function, please set Req_Pose_Num of Start Mech-Vision Project to 0 to reduce the times of execution of the function. If Req_Pose_Num of Start Mech-Vision Project is set to 1, then every time the function is executed, only 1 waypoint can be returned, and the function must be executed multiple times to obtain all the waypoints.
mc cmd 7

Parameters

Input Parameters

  • Vision_Proj_Num: Mech-Vision project ID, which is the number before the project name in the Project List panel in Mech-Vision.

  • Request_Pose_Type: The pose type of waypoints returned by the Path Planning Step.

    • 1: The waypoint poses are returned in the form of joint positions.

    • 2: The waypoint poses are returned in the form of TCP.

The Request_Pose_Type here and Robot_Pose_Type of the MM_Start_Vis and MM_Start_Viz FB all correspond to the Pose_Type variable of the global label MM_Camera. Therefore, if these parameters are set to different values, the programming should ensure that the two values do not take effect at the same time.
  • Get_VisData: Obtains the planned path from the “Path Planning” Step in Mech-Vision at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 1103 will be returned. Otherwise, the corresponding error code will be returned.

  • Status_of_Pose_Sent: 1 represents that the pose data written in are new. After the PLC reads the pose data, please run the MM_Empty_Target FB to reset the register to 0.

  • Number_of_Pose_Sent: The number of waypoints output by the “Path Planning” Step in Mech-Vision, from 1 to 20.

  • Index_of_Vision_Picking_Point: The position of the Vision Move waypoint in the entire robot motion path. For example, if the path is composed of Steps Fixed-Point Move_1, Fixed-Point Move_2, Vision Move, and Fixed-Point Move_3 sequentially, the position of Vision Move is 3.

  • Target_Pose: The waypoint poses in TCP. The type is determined by Request_Pose_Type.

  • Target_Label: Label of a single waypoint.

  • Target_Tool_ID: The tool ID specified in the path planning tool.

Example

When Camera_User.Get_VisData is at the rising edge, this example obtains the planned path from Mech-Vision No.1 in the form of joint positions.

mc cmd 8

Start Mech-Viz Project

In scenarios where both Mech-Vision and Mech-Viz are used, this function starts the Mech-Viz project that triggers the corresponding Mech-Vision project, and therefore the Mech-Viz project can plan the robot path based on the vision points received from Mech-Vision.

mc cmd 9

Parameters

Input Parameters

  • Robot_Pose_Type: The type of robot pose to input to Mech-Viz. The value range is 0 to 2.

  • Camera_User.Robot_Pose_JPS: Current joint positions of the robot. The data type is one-dimensional Array [0..5] of Real.

  • Camera_User.Robot_Pose_Flange: Current flange pose of the robot. The data type is one-dimensional Array [0..5] of Real.

The following table explains the relationship between Robot_Pose_Type and Camera_User.Robot_Pose_JPS/Camera_User.Robot_Pose_Flange.

Robot_Pose_Type Camera_User.Robot_Pose_JPS Camera_User.Robot_Pose_Flange Description Applicable scenario

0

0, 0, 0, 0, 0, 0

0, 0, 0, 0, 0, 0

No need to input the robot pose to Mech-Viz. The simulated robot in Mech-Viz moves from the initial pose JPs = [0, 0, 0, 0, 0, 0] to the first waypoint.

Project is in the eye-to-hand mode. This setting is not recommended.

1

Current joint positions of the robot

Current flange pose of the robot

Robot joint positions and flange pose must be input to Mech-Viz. The simulated robot in Mech-Viz moves from the input JPs to the first waypoint.

This setting is recommended for projects in the eye-in-hand mode.

2

Specific joint positions of the robot

0, 0, 0, 0, 0, 0

The robot joint positions of a point determined by teaching must be input to Mech-Viz. The input joint positions are used to trigger Mech-Viz 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 for projects in the Eye-To-Hand mode.

The reason for setting Robot_Pose_Type to 2 when the project is in the Eye-To-Hand mode: In the Eye-To-Hand mode, the camera can perform image capturing for the next round of path planning before the robot returns to the camera capture region and picking region, shortening the cycle time. If Robot_Pose_Type is set to 1, the robot’s current pose is sent to Mech-Viz. The simulated robot will move from the input pose to the first waypoint in the planned path, while the real robot might move to another point first, and then move to the first waypoint. Therefore, the path of the real robot may contain unpredicted collisions, leading to safety hazards. In conclusion, Robot_Pose_Type should be set to 2 for projects in the Eye-To-Hand setup.

mc cmd 10
  • Start_Viz: Trigger the Mech-Viz project to run at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 2103 will be returned. Otherwise, the corresponding error code will be returned.

Example

When the label “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.

mc cmd 11

Stop Mech-Viz Project

This function stops the execution of the Mech-Viz Project. This function is only needed if the Mech-Viz project falls into an infinite loop or cannot be stopped normally.

mc cmd 12

Parameters

Input Parameters

  • Stop_Viz: Stop Mech-Viz project at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 2104 will be returned. Otherwise, the corresponding error code will be returned.

Example

When the label Camera_User.Stop_Viz is at the rising edge, this example stops the Mech-Viz project.

mc cmd 13

Select Mech-Viz Branch

This function is used to select along which branch the Mech-Viz project should proceed. Such branching is achieved by adding Branch by Msg Step(s) to the project. Before you execute this function, run Function 201: Start Mech-Viz Project. Mech-Viz waits for the exit port specified by this function to take for Branch by Msg Step(s).

mc cmd 14

Parameters

Input Parameters

  • Branch_Name: The Step ID (integer) of the Branch by Msg Step.

  • Branch_Exit_Port: The exit port of the specified Step, i.e., the branch, the project should run along. The value should be an integer.

    An exit port number is the 1-based index of the specified exit port on the Step. For example, if the specified exit port is the second exit port of the Step from left to right, the exit port number is 2.
  • Set_Branch: Set the branch to take at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 2105 will be returned. Otherwise, the corresponding error code will be returned.

Example

When the label Camera_User.Set_Branch is at the rising edge, this example tells Mech-Viz to take exit port 1 for the Branch by Msg Step whose Step ID is 1.

mc cmd 15

Set Move Index

This function is for setting the index parameter of a Step that involves sequential or separate motions or operations. Steps with index parameters include Move by List, Move by Grid, Custom Pallet Pattern, Smart Pallet Pattern, etc.

Start Mech-Viz Project must be called BEFORE this function.

mc cmd 16

Parameters

Input Parameters

  • Index_Name: The ID of the Step with the Index parameters.

  • Index_Counter: The index value that should be set the next time this Step is executed. When this function is sent, the current index value in Mech-Viz will become the parameter value minus 1. When the Mech-Viz project runs to the Step specified by this function, the current index value in Mech-Viz will be increased by 1 to become the parameter’s value.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 2106 will be returned. Otherwise, the corresponding error code will be returned.

Example

When the label Camera_User.Set_Index is at the rising edge, this example sets the Current Index value to 3 for the Step in the Mech-Viz project whose Step ID is 5. When the Step is executed, the Current Index value will be added 1 and become 4.

mc cmd 17

Get Mech-Viz Planned Path

This function obtains the planned path from Mech-Viz.

mc cmd 18

Parameters

Input Parameters

  • Request_Pose_Type: Specifies the type of waypoint poses obtained.

    • 1: The waypoint poses are returned in the form of joint positions.

    • 2: The waypoint poses are returned in the form of TCP.

The Request_Pose_Type here and Robot_Pose_Type of the MM_Start_Vis and MM_Start_Viz FB all correspond to the Pose_Type variable of the global label MM_Camera. Therefore, if these parameters are set to different values, the programming should ensure that the two values do not take effect at the same time.
  • Get_VisData: Obtain the planned path from Mech-Viz at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 2100 will be returned. Otherwise, the corresponding error code will be returned.

  • Status_of_Pose_Sent: 1 represents that the pose data written in are new. After the PLC reads the pose data, please run the MM_Empty_Target FB to reset the register to 0.

  • Number_of_Pose_Sent: The number of waypoints output from Mech-Viz, from 1 to 20.

  • Index_of_Vision_Picking_Point: The position of the Vision Move waypoint in the entire robot motion path. For example, if the path is composed of Steps Fixed-Point Move_1, Fixed-Point Move_2, Vision Move, and Fixed-Point Move_3 sequentially, the position of Vision Move is 3.

  • Target_Pose: The waypoint poses in TCP. The type is determined by Request_Pose_Type.

  • Target_Label: Label of a single waypoint.

  • Target_Tool_ID: The tool ID specified in the Mech-Viz project.

Example

When the label Camera_User.Get_VizData is at the rising edge, this example obtains the planned path from Mech-Viz in the form of TCPs.

mc cmd 19

Get DO Signal List

This function obtains the control signal list for the multi-section vacuum gripper from the Mech-Vision or Mech-Viz project. Before calling this function, please call Function 105: Get Path Planning Result from Mech-Visionor Function 205: Get Planned Path from Mech-Viz.

mc cmd 20

Before using this function, you must perform the following configurations in Mech-Vision or Mech-Viz.

  • Configure the Mech-Vision project

    • In the Path Planning Step, click Config wizard. In Global configuration, enable Box depalletizing.

      vision move vis
    • In the Path Planning Step, click Config wizard, 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 the Mech-Viz project

    • In the Vision Move Step of Mech-Viz, set Select Picking Method to Box depalletizing.

      vision move viz
    • 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 signals according to needs.

      sucker viz

Parameters

Input Parameters

  • Vision_Proj_Num: This parameter specifies the source of the DO signal list. 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.

  • Tool_Section_Num: This parameter indicates the number of vacuum gripper sections.

  • Get_DoList: Obtain the planned DO signal list at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 2102 will be returned. Otherwise, the corresponding error code will be returned.

  • DO_LIST: 64 DO signals returned by this function.

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

In this example, when a rising edge is detected for the Camera_User.Get_DoList label, if Vision_Proj_Num is 0 and Tool_Section_Num is 3, the DO signal list returned by Mech-Viz will be saved to the DO array.

mc cmd 21

Input Object Dimensions to Mech-Vision

This function is used for dynamically inputting object dimensions into the Mech-Vision project. Please confirm the actual object dimensions before running the Mech-Vision project.

The Mech-Vision project should contain the Read Object Dimensions Step, and the Step’s parameter Read Sizes from Properties should be selected.

mc cmd 22

Parameters

Input Parameters

  • Vision_Proj_Num: Mech-Vision project ID, which is the number before the project name in the Project List panel in Mech-Vision.

  • Camera_User.External_Input_Box_Dimension: Input the object’s length, width, and height (in mm) to the Mech-Vision project.

  • Set_Box_Dimension: Inputs the object dimensions in the Mech-Vision project dynamically at the rising edge.

Returned data from the MM_Camera global label:

  • Status_Code: If there is no error, status code 1108 will be returned. Otherwise, the corresponding error code will be returned.

Example

In this example, when the label Camera_User.Set_Box_Dimension has a rising edge, the dimensions read by Step “Read Object Dimensions” in the Mech-Vision project will be set to the value of External_Input_Box_Dimension[0–2].

mc cmd 23

Get Software Status

This function is designed for obtaining the software execution status. The function is currently capable of only checking whether Mech-Vision is ready to run projects.

mc cmd 26

Parameters

Input Parameters

  • Get_Status: Checks whether Mech-Vision is ready to run projects at the rising edge.

Returned data from the MM_Camera global label:

  • Status code: Represent the software status. 1101 indicates that Mech-Vision is ready to run projects. Other status code indicates that Mech-Vision is not ready.

Example

When the label Camera_User.Get_Status is at the rising edge, this example checks the status code and stores it in MM_Camera.Status_Code.

mc cmd 27

Clear Target Data

This function clears the obtained data stored in Target_Pose, Target_Label, and Target_Tool_ID.

mc cmd 28

Parameters

Input Parameters

  • Start_Empty: Clear the data stored in Target_Pose, Target_Label, and Target_Tool_ID at the rising edge.

Returned data from the MM_Camera global label:

  • Target_Pose: Obtained pose data.

  • Target_Label: Obtained label.

  • Target_Tool_ID: The obtained tool ID.

Example

When the Camera_User.Start_Empty label is at the rising edge, the data stored in Target_Pose, Target_Label, and Target_Tool_ID are cleared.

mc cmd 29

Get Message from Notify Step

After the Mech-Vision or Mech-Viz project is triggered, this function can be called to get message from 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 1 second. Therefore, users 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.
mc cmd 30

Parameters

Input Parameters

  • Get_Notify: Get a message from the “Notify” Step, triggered at a rising edge.

Returned data from the MM_Camera global label:

  • Notify: The message from the Notify Step, which is an integer.

Example

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

mc cmd 31

Example Description

In this example, when D11042 (namely, Camera_User.Step_Num) is set to 3 in the automatic mode, the value of MM_Camera.Notify is not 777. After the MM_Get_Notify function 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. Otherwise, if the value remains unchanged, the PLC will prompt an error after 3 seconds.

Appendix

Description of the Status Codes

Please refer to Status Codes and Troubleshooting for detailed information.

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.