Example Program 5: MM_S5_Viz_SetBranch

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.

Program Introduction

Description

The PLC starts the Mech-Viz project, sets the exit port for the Branch by Msg Step, and then obtains the planned path from the Mech-Viz project.

File path

The example files are stored in Communication Component/Robot_Interface/PROFINET/Programming Samples/sample applications/SampleProjectProfinet.zip in the directory where Mech-Vision and Mech-Viz are installed.

Project

Mech-Vision project and Mech-Viz project (The Branch by Msg Step needs to be configured beforehand.)

Prerequisites

This example program is provided for reference only. Before using the program, please modify the program according to the actual scenario.

Program Description

This part describes the MM_S5_Viz_SetBranch example program.

The only difference between the MM_S5_Viz_SetBranch example program and the MM_S2_Viz_Basic example program is that MM_S5_Viz_SetBranch can set the exit port of the Branch by Msg Step in the Mech-Viz project (Network 6). As such, only the feature of setting the exit port of the Branch by Msg Step is described in the following section. For information about the parts of MM_S5_Viz_SetBranch that are consistent with those of MM_S2_Viz_Basic, see Example Program: MM_S2_Viz_Basic.
sample5 1
sample5 2
sample5 3
sample5 4
sample5 5
sample5 6
sample5 7

The figure below describes the process of the above example program. The feature of setting the exit port of the Branch by Msg Step in the Mech-Viz project in the above program is shown in the section indicated by the red line in the figure below.

sample5 8

The table below describes the process of setting the exit port of the Branch by Msg Step in the Mech-Viz project.

  • For the Standard Interface commands for PROFINET communication in Siemens PLCs, you can click the hyperlink to the command name in the following explanation to view the detailed description of the command.

  • For common commands that come with Siemens S7 Series PLC, see Common Commands.

Feature Description

Set the exit port for the Branch by Msg Step in the Mech-Viz project and determine the subsequent operations based on whether the exit port is set successfully

sample5 6
  • "Camera_User".Set_Branch: The flag that triggers the exit port of the Branch by Msg Step to be set when a rising edge occurs.

  • "Camera_User".Status_Code_Error[10]: A vision system status code exception flag. True indicates that the exit port of the Branch by Msg Step in the Mech-Viz project failed to be set, which means that the vision system is abnormal.

For more information about input and output parameters in MM_Set_Branch, see MM_Set_Branch.

Network 6 indicates that if "Camera_User".Step_Num is set to 8, the following operations are performed.

  1. MM_Set_Branch is enabled. In this case, the Branch by Msg Step ID and exit port number are 1 by default. You can modify the Step ID and exit port number based on actual scenarios. In other words, the Mech-Viz project will proceed along exit port 0 of the 1 Branch by Msg Step, as shown in the following figure.

    set branch
  2. When "MM_Set_Branch".ENO is True and "CameraIO".MM.FromCamera.TRIGGER_ACKNOWLEDGE is False, "Camera_User".Set_Branch is set and the PLC will trigger Mech-Viz to set the exit port of the Branch by Msg Step.

  3. If "CameraIO".MM.FromCamera.STATUS_CODE is between 2001 and 2099 (inclusive), it indicates a vision system error. At this point, the rising edge of this logical output is captured using the P_TRIG command, "Camera_User".Status_Code_Error[10] is set, and "Camera_User".Set_Branch is reset. For information about the cause of a specific status code, see Standard Interface status codes and error codes.

  4. If "CameraIO".MM.FromCamera.STATUS_CODE equals 2105 and "CameraIO".MM.FromCamera.COMMAND_COMPLETE is True, it means the vision system has successfully executed the command sent by the PLC. At this point, the rising edge of this logical output is captured using the P_TRIG command, "Camera_User".Step_Num is set to 10, and "Camera_User".Set_Branch and "Camera_User".Status_Code_Error[10] are reset.

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.