Communication Configuration and Example Program Usage

You are currently viewing the documentation for the latest version (2.1.2). 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.

This topic provides two methods on setting up the Standard Interface communication based on the EtherNet/IP protocol between a Beckhoff PLC and the Mech-Mind Vision System.

  • Use a PCI-e card.

  • Configure the software. No cards are required.

  • You should choose one of the methods to set up the communication. You cannot choose both methods.

  • Software configuration has a longer response time compared to using the card. For projects requiring high cycle performance, it is recommended to prioritize using the card.

Hardware and Software Requirements

Hardware

If you configure the software to set up the EtherNet/IP communication, click this line to view the required hardware and hardware connection settings.
  • A Beckhoff PLC.

  • An IPC.

  • A network switch and Ethernet cables.

beckhoff 1
If you use a PCI-e card to set up the EtherNet/IP communication, click this line to view the required hardware and hardware connection settings.
  • A Beckhoff PLC.

  • An IPC is equipped with a standard PCIe communication card, HMS IXXAT INpact 40.

  • A network switch and Ethernet cables.

beckhoff 2

Software

If you configure the software to set up the EtherNet/IP communication, click this line to view the required software.
Software Description Installed location

TwinCAT 3

Beckhoff PLC programming software

Computer for Beckhoff PLC programming

Mech-Vision & Mech-Viz (2.0.0 or above)

Software that provides the Mech-Mind Vision System

IPC

Apart from the above software, copy the following files to the computer where TwinCAT 3 is installed.

  • Software EIP.eds file: Used to provide the identity information of the IPC in the EtherNet/IP network.

    The Software EIP.eds file can be found in the Communication Component/Robot_Interface/EthernetIP/EDS path in the directory where Mech-Vision and Mech-Viz are installed.
  • MM_Camera.tpzip: A PLC example program file. After importing this file into TwinCAT 3, you will obtain the following example program files:

    • CameraSignalsMove: Used to transfer the vision system signals.

    • MM_XXX_XXX FB: Used to implement the features of various interface commands.

    • fcCameraTestManually: An example program (manual mode).

    • fbCameraTestAuto: An example program (automatic mode).

    • fbCameraTestAuto_Notify: The sample message that is obtained.

      The MM_Camera.tpzip file is located in the following folder within the Mech-Vision and Mech-Viz software installation path:
      Communication Component/Robot_Interface/EthernetIP/Programming Samples/BECKHOFF PLC EthernetIP.
If you use a PCI-e card to set up the EtherNet/IP communication, click this line to view the required software.
Software Description Installed location

TwinCAT 3

Beckhoff PLC programming software

Computer for Beckhoff PLC programming

Communication card driver software

IPC

Mech-Vision & Mech-Viz (2.0.0 or above)

Software that provides the Mech-Mind Vision System

IPC

Used for setting up the IP address of the PCIe card

IPC

Apart from the above software, copy the following files to the computer where TwinCAT 3 is installed.

  • 005A002B003A0100.EDS file: Provide the IPC identity information on the EtherNet/IP network.

    The 005A002B003A0100.EDS file can be found in the Communication Component/Robot_Interface/EthernetIP/EDS path in the directory where Mech-Vision and Mech-Viz are installed.
  • MM_Camera.tpzip: A PLC example program file. After importing this file into TwinCAT 3, you will obtain the following example program files:

    • CameraSignalsMove: Used to transfer the vision system signals.

    • MM_XXX_XXX FB: Used to implement the features of various interface commands.

    • fcCameraTestManually: An example program (manual mode).

    • fbCameraTestAuto: An example program (automatic mode).

    • fbCameraTestAuto_Notify: The sample message that is obtained.

      The MM_Camera.tpzip file is located in the following folder within the Mech-Vision and Mech-Viz software installation path:
      Communication Component/Robot_Interface/EthernetIP/Programming Samples/BECKHOFF PLC EthernetIP.

Configure Communication

If you configure the software to set up the EtherNet/IP communication, click this line to view the detailed operations.
  1. Click Robot Communication Configuration on the toolbar of Mech-Vision.

  2. In the Robot Communication Configuration window, complete the following configurations.

    1. Click the Select robot drop-down menu, and select Listed robot. Click Select robot model, and select the robot model that you use. Then, click Next.

    2. In the Communication mode section, set Interface service type to Standard Interface, set Protocol to ETHERNET IP (Software), and set Network Adapters and IP Address to the network adapter and IP address used by the IPC.

    3. (Optional) Select Auto enable interface service when opening the solution.

    4. Click Apply.

      ethernet ip software
  3. On the main interface of Mech-Vision, make sure that the Robot Communication Configuration switch on the toolbar is flipped and has turned blue.

    interface service
If you use a PCI-e card to set up the EtherNet/IP communication, click this line to view the detailed operations.

Check PCI-e Card and Driver Software

  1. Please make sure that the INpact EIP Slave PCIe interface card has been pressed into the PCI-e slot of the IPC, as shown below.

    ethernet ip ab 2
  2. Make sure the driver software is installed on the IPC: Right-click the Windows icon, and click Device Manager to open it. Find VCI4 INpact PCIe under IXXAT VCI V4 Interfaces.

    ethernet ip ab 3

Set up “Robot Communication Configuration”

  1. Open Mech-Vision, and you may enter different interfaces. Create a new solution according to the instructions below.

    • If you have entered the Welcome interface, click New blank solution.

      create solution 1

    • If you have entered the main interface, click File  New Solution on the menu bar.

      create solution 2

  2. Click Robot Communication Configuration on the toolbar of Mech-Vision.

  3. In the Robot Communication Configuration window, complete the following configurations.

    1. Click the Select robot drop-down menu, and select Listed robot. Click Select robot model, and select the robot model that you use. Then, click Next.

    2. In the Communication mode area, select Standard Interface for Interface service type and select ETHERNET IP for Protocol.

    3. (Optional) Select Auto enable interface service when opening the solution.

    4. Click Apply.

      ethernet ip
  4. On the main interface of Mech-Vision, make sure that the Robot Communication Configuration switch on the toolbar is flipped and turned to blue.

    interface service

Configure IP address of the PCIe Card

Ensure the interface service has been enabled before proceeding with the following operations.
  1. Use an Ethernet cable to connect the network ports of the IPC and the INpact EIP Slave PCIe.

    After configuring the IP and initiating communication successfully, the Ethernet cable used here can be removed.
  2. Open HMS IPconfig, click the scan icon and unselect “Retrieve IP settings dynamically from a DHCP server”, and then enter the IP address and subnet mask. After configuration, click Apply and exit the software.

    ethernet ip ab 6

Create and Configure the PLC Project

Create PLC Project

  1. On the computer, open TwinCAT 3 and click New TwinCAT Project. The New Project window will appear.

    beckhoff 3
  2. In the following window, select TwinCAT XAE Project (XML format), enter a project name, and then choose a save location as needed. Leave the other options as default and click OK.

    beckhoff 4
  3. In the left navigation pane, double-click SYSTEM.

    beckhoff 5
  4. In the following window, select General  Choose Target…​.

    beckhoff 6
  5. In the following window, select the controller to which you want to connect and click OK.

    • <Local> indicates a connection to the local virtual controller. In this example, <Local> is selected.

    • To connect to another controller, click Search (Ethernet)…​. For detailed instructions, see Connecting to a Controller.

    beckhoff 7

Add TF6281 (EtherNet/IP Scanner) Component

  1. In the left navigation pane, double-click I/O, right-click Devices, and then select Add New Item.

    beckhoff 8

    In the window that appears, set Type to EtherNet/IP Scanner, leave Name as the default Device 1, and then click OK.

    beckhoff 9
  2. In the following window, click Settings, expand F800:0, double-click F800:21, change the IP address, and then click OK.

    The IP address set here must be on the same subnet as the IPC.
    beckhoff 10

    Double-click F800:22, change the subnet mask, and then click OK.

    beckhoff 11

Install EDS File and Configure Communication

  1. In the left navigation pane, right-click Device 1 (TC3 EIP Scanner) and select Import EDS File.

    beckhoff 12

    In the window that appears, select the EDS file (which should be copied from the IPC beforehand) and click Open.

    • The EDS file can be found in the Communication Component/Robot_Interface/EthernetIP/EDS path in the directory where Mech-Vision and Mech-Viz are installed.

    • If you configure the software to set up the EtherNet/IP communication, select the Software EIP.eds file. If you use a PCI-e card to set up the EtherNet/IP communication, select the 005A002B003A0100.EDS file. In this example, the 005A002B003A0100.EDS file is selected.

    beckhoff 13
  2. After the EDS file is installed, right-click Device 1 (TC3 EIP Scanner) and select Add New Item.

    beckhoff 14

    In the window that appears, expand HMS Industrial Networks AB, select Ixxat INpact EtherNet/IP (TM), enter a Name (customizable, e.g., Camera_3D), and then click OK.

    beckhoff 15
  3. Right-click the newly added Ixxat INpact EtherNet/IP (TM) and select Change IP Address.

    beckhoff 16

    In the window that appears, change the IP address and then click OK.

    • If you configure the software to set up the EtherNet/IP communication, the IP address should be consistent with the network adapter IP address selected in the Robot Communication Configuration in Mech-Vision.

    • If you use a PCI-e card to set up the EtherNet/IP communication, the IP address should be consistent with the IP address set in HMS IPconfig.

    beckhoff 17
  4. Right-click Ixxat INpact EtherNet/IP(TM) again, select Append IO Connection  Exclusive Owner.

    beckhoff 18

    Click Yes in the pop-up window as shown below.

    beckhoff 19

    A connection variable, Connection 1 (Input/Output), is created, as shown in the figure below.

    beckhoff 20

Import Example Programs

Before you add the example program to a project already in use, it is recommended to import it to a new project and test it first.
  1. In the left navigation pane, right-click PLC and select Add Existing Item.

    beckhoff 21

    In the window that appears, select the MM_Camera.tpzip file (which should be copied from the IPC beforehand), and click Open.

    The MM_Camera.tpzip file is located in the Communication Component/Robot_Interface/EthernetIP/Programming Samples/BECKHOFF PLC EthernetIP folder under the installation path of Mech-Vision and Mech-Viz.
    beckhoff 22

    Click Yes in the pop-up window as shown below.

    beckhoff 23
  2. In the left navigation pane, expand PLC and ensure that both CameraSignalsMove.FromCameraBytes and CameraSignalsMove.ToCameraBytes are linked to Connection 1 (Input/Output).

    beckhoff 24
    beckhoff 25

    If the variables are not linked automatically, click Linked to…​. In the window that appears, select the corresponding variables to link them manually. For example, the figure below shows that CameraSignalsMove.FromCameraBytes and CameraSignalsMove.ToCameraBytes are linked manually.

    beckhoff 26
    beckhoff 27

Activate Configuration and Log In to the PLC Program

  1. In the toolbar, click Activate Configuration.

    beckhoff 28

    In the window that appears, set Project and Target, and then click OK.

    beckhoff 29

    In the window that appears, click Continue.

    beckhoff 30

    In the window that appears, click OK.

    beckhoff 31
  2. In the toolbar, click Login, and the PLC will enter Run mode.

    beckhoff 32

Check Communication

  1. In the left navigation pane, double-click MM.

    beckhoff 33

    If the connection is successful, the FromCamera.HEARTBEAT signal in the MM variable table will continuously change.

    beckhoff 34
  2. The PLC is successfully connected if the following message is displayed in the Console tab of Mech-Vision Log panel: Connect to ETHERNET IP controller successfully. If you don’t see this log message, please check the following:

    1. If the hardware is properly connected;

    2. If the Interface Service has been enabled successfully in Mech-Vision;

    3. If the TwinCAT 3 project configuration has been successfully activated;

    4. If the PLC program has been successfully logged in and started.

Test with Mech-Vision/Mech-Viz Project

This section introduces how to use the example program FB to trigger the Mech-Vision project to obtain vision result and trigger the Mech-Viz project to obtain the planned path.

Preparations

  1. Return to Mech-Vision and create a Mech-Vision project. Right-click the solution and select Autoload Solution. Projects in the solution are also autoloaded. Meanwhile, the project number will show up before each project name.

  2. Create Mech-Viz project: Right-click the project name in Resources of Mech-Viz and select Autoload Project.

    The Mech-Viz project used for testing should contain a “Branch by Msg” Step that has been renamed to 1 as shown below.

    ethernet ip ab 54

Getting Vision Result from Mech-Vision

Set Parameters

  1. In the TwinCAT 3 software navigation pane, double-click fcCameraTestManually.

    beckhoff 35
  2. In section 1 of the fcCameraTestManually program, set the enable switch MM.ToCamera.COM_ENABLE to ON.

    beckhoff 36
  3. In section 4 of the fcCameraTestManually program, set the following values.

    1. Set the port value of Vision_Proj_Num to 1, which means that Mech-Vision project No.1 will be run.

    2. Set the value of Req_Pose_Num to 0, which means that all vision points will be expected to be returned by Mech-Vision.

    3. Set the value of Robot_Pose_Type to 0. Then, the image-capturing pose does not need to be sent to the Mech-Vision project. For example, the image-capturing pose does not need to be sent when the camera is mounted in eye-to-hand mode.

      beckhoff 37

Trigger Mech-Vision Project to Run

  1. In section 4 of the fcCameraTestManually program, double-click the MM.Camera_User.Step_Num variable. In the input box that appears, enter 4 to set the next write value of MM.Camera_User.Step_Num to 4, and then click OK.

    beckhoff 38
  2. In section 4 of the fcCameraTestManually program, double-click the MM.Camera_User.Start_Vis variable and set it to TRUE.

    beckhoff 39
  3. In the toolbar, click Write values to trigger the Mech-Vision project to run.

    beckhoff 40
  4. Double-click the MM.Camera_User.Start_Vis variable again and set it to FALSE.

  5. Check whether the returned value of STATUS_CODE is 1102.

    1. Click the Watch 1 tab in the status bar to log in to the watch window, and then add the MM.FromCamera variable.

      beckhoff 41
    2. Expand the MM.FromCamera variable and check the STATUS_CODE value.

      beckhoff 42
      • If the STATUS_CODE value is 1102, it indicates that the Mech-Vision project has been successfully triggered to run.

      • If 10XX is displayed for STATUS_CODE and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

Get Vision Result from Mech-Vision

  1. After STATUS_CODE returns 1102, go to section 5 of the fcCameraTestManually program and set the next write value of MM.Camera_User.Step_Num to 6.

    Double-click the MM.Camera_User.Get_VisData variable and set it to TRUE to obtain the vision result.

    beckhoff 43
  2. In the toolbar, click Write values to obtain the vision result.

    beckhoff 40
  3. Double-click the MM.Camera_User.Get_VisData variable again and set it to FALSE.

  4. In the watch window, check the STATUS_CODE value.

    beckhoff 44
    • If the STATUS_CODE value is 1100, it indicates that the vision result has been successfully obtained.

    • If 10XX is displayed for STATUS_CODE and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

  5. Check the values of Target_Pose.

    1. In the watch window, add the MM.Camera_User variable.

      beckhoff 45
    2. Expand the MM.Camera_User variable and check the Target_Pose values. In the figure, two sets of pose data sent by the vision system software are shown. Divide the pose data by 10000 to obtain the actual pose data.

      beckhoff 46

Automate the Process of Getting Vision Result from Mech-Vision

The previous section introduces how to manually obtain the vision result from Mech-Vision. To automate the process of obtaining the vision result from Mech-Vision, connect the programs as the following example.

beckhoff 47
beckhoff 48

Run Mech-Viz Project and Obtain Planned Path

Set Parameters

  1. In section 7 of the fcCameraTestManually program, set the next write value of MM.Camera_User.Step_Num to 10.

    Double-click the MM.Camera_User.Start_Empty variable and set it to TRUE to clear the previously obtained vision result.

    beckhoff 49
  2. In the toolbar, click Write values.

    beckhoff 40
  3. Double-click the MM.Camera_User.Start_Empty variable again and set it to FALSE.

  4. Check the values of Target_Pose after the vision result is cleared in the watch window.

    beckhoff 50
  5. In section 12 of the fcCameraTestManually program, set the port values of Branch_Name and Branch_Exit_Port to 1, indicating that the Mech-Viz project will take exit port 1 of the Branch by Msg Step whose Step ID is 1.

    beckhoff 51
  6. In section 13 of the fcCameraTestManually program, set the port value of Request_Pose_Type to 1, indicating that the waypoints planned by Mech-Viz will be returned in the form of joint positions.

    beckhoff 52

Trigger Mech-Viz Project to Run

  1. In section 9 of the fcCameraTestManually program, set the next write value of MM.Camera_User.Step_Num to 14.

    Double-click the MM.Camera_User.Start_Viz variable and set it to TRUE to trigger the Mech-Viz project to run.

    beckhoff 53
  2. In the toolbar, click Write values to trigger the Mech-Viz project to run.

    beckhoff 40
  3. Double-click the MM.Camera_User.Start_Viz variable again and set it to FALSE.

  4. In the watch window, check the STATUS_CODE value.

    beckhoff 54
    • If the STATUS_CODE value is 2103, it indicates that the Mech-Viz project has been successfully triggered to run.

    • If 20XX is displayed for STATUS_CODE and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

Set the Exit Port for the Branch by Msg Step in Mech-Viz

  1. In section 12 of the fcCameraTestManually program, set the next write value of MM.Camera_User.Step_Num to 20.

    Double-click the MM.Camera_User.Set_Branch variable and set it to TRUE to set the exit port of the Branch by Msg Step.

    beckhoff 55
  2. In the toolbar, click Write values to set the exit port of the Branch by Msg Step.

    beckhoff 40
  3. Double-click the MM.Camera_User.Set_Branch variable again and set it to FALSE.

  4. In the watch window, check the STATUS_CODE value.

    beckhoff 56
    • If the STATUS_CODE value is 2105, it indicates that the exit port of the Branch by Msg Step has been successfully set.

    • If 20XX is displayed for STATUS_CODE and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

Obtain Mech-Viz Planned Path

  1. In section 13 of the fcCameraTestManually program, set the next write value of MM.Camera_User.Step_Num to 22.

    Double-click the MM.Camera_User.Get_VizData variable and set it to TRUE to obtain the planned path.

    Check the value of MM.FromCamera.SEND_POSE_NUM later.
    beckhoff 57
  2. In the toolbar, click Write values to obtain the planned path.

    beckhoff 40
  3. Double-click the MM.Camera_User.Get_VizData variable again and set it to FALSE.

  4. The MM.FromCamera.SEND_POSE_NUM value is 2, indicating that two sets of joint position data were obtained in this example.

  5. In the watch window, check the STATUS_CODE value.

    beckhoff 58
    • If the STATUS_CODE value is 2100, it indicates that the planned path has been successfully obtained.

    • If 20XX is displayed for STATUS_CODE and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

  6. Check the returned values of Target_Pose in the watch window. Divide the returned values by 10000 to obtain the actual pose data.

    beckhoff 59

Automate the Process of Getting Planned Path from Mech-Viz

The previous section introduces how to manually obtain the planned path from Mech-Viz. To automate the process of obtaining the planned path from Mech-Viz, connect the programs as the following example.

beckhoff 60
beckhoff 61
beckhoff 62

Is this page helpful?

You can give a feedback in any of the following ways:

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.