Interface Commands

This topic introduces the commands for the communication between a Siemens PLC and the Mech-Mind Software Suite through the Mech-Center Modbus TCP Standard Interface.

Introduction

Mech-Center Modbus TCP Standard Interface

Mech-Center supports communication based on the Modbus TCP protocol. With the Standard Interface option MODBUS TCP SLAVE selected, Mech-Center serves as the slave and communicates with the master device.

PLC Example Programs

  • MM Modbus TCP.scl (for setting up Modbus TCP communication)

  • MM Modbus TCP Interface Program.scl (for realizing the functions of interface commands)

Note

File location: XXXX/Mech-Center-xxx/Robot_Interface/Modbus TCP/Siemens TIA Portal (the installation directory of Mech-Center)

Please copy the files to the computer with Siemens TIA Portal installed.

Commands

Start Mech-Vision Project

This command is for applications that use Mech-Vision but not Mech-Viz. It runs the corresponding Mech-Vision project to acquire and process data, as well as sending the image capturing pose for Eye-In-Hand installation.

../../../../_images/start_mech_vision_13.png

Parameters

  • Input parameters

    Vision_Proj_Num

    Mech-Vision Project ID, from 1 to 99.

    Can check and adjust in Mech-Center ‣ Deployment Settings ‣ Mech-Vision

    Req_Pose_Num

    Number of vision points for Mech-Vision to send, from 0 to 20, where 0 means “send all”.

    Robot_Pose_Type

    Set the image-capturing pose for the robot to send, from 0 to 2.

    0: Do not send image-capturing pose (for Eye To Hand) 1: Send image-capturing pose as joint positions 2: Send image-capturing pose as robot flange pose

    Robot_Pose

    The image-capturing pose sent by the robot, as an array of 6 real numbers.

    Start_Vision

    Start the Mech-Vision project at the rising edge.

    Set_Edge

    Store the value of Start_Vision in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    1102 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/start_mech_vision_23.png

When “Camera_User”.Start_Vis is at the rising edge, this example runs Mech-Vision project No. 1, asks the project to send over 1 vision point, and sends the robot joint positions when the Mech-Vision project is started as the image-capturing pose to Mech-Center.

Get Vision Target(s)

This command is for applications that use Mech-Vision but not Mech-Viz. It obtains the vision result from the corresponding Mech-Vision project.

../../../../_images/get_mech_vision_data_13.png

Parameters

  • Input parameters

    Vision_Proj_Num

    Mech-Vision Project ID, from 1 to 99.

    Can check and adjust in Mech-Center ‣ Deployment Settings ‣ Mech-Vision.

    Get_VisData

    Obtain the vision result from the Mech-Vision project at the rising edge.

    Set_Edge

    Store the value of Get_VisData in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    1100 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

    Status of Pose Sent

    1 represents that the target data written in are new.

    After the PLC reads the pose data, please run the MM_Empty_Target FC to reset the register to 0.

    Number of Pose Sent

    Store the number of received vision points, from 1 to 20.

    Target Pose

    Store the received target poses as TCPs.

    Target Label

    Store the integer labels corresponding to the poses. Labels are set in Mech-Vision.

Example

../../../../_images/get_mech_vision_data_23.png

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

Switch Mech-Vision Recipe

This command specifies which parameter recipe of the Mech-Vision project to use. For more information on parameter recipe, please see Parameter Recipe.

Note

  • This command must be executed BEFORE MM_Start_Vis.

  • The corresponding Mech-Vision project must have parameter recipes already configured and saved.

../../../../_images/set_formula_13.png

Parameters

  • Input parameters

    Vision_Proj_Num

    Mech-Vision Project ID, from 1 to 99.

    Can check and adjust in Mech-Center ‣ Deployment Settings ‣ Mech-Vision.

    Vision_Recipe_Num

    The number of a parameter recipe in the Mech-Vision project, from 1 to 99.

    Switch_Recipe

    Switch the parameter recipe at the rising edge.

    Set_Edge

    Store the value of Switch_Recipe in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    1107 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/set_formula_23.png

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.

Start Mech-Viz Project

This command is for applications that use both Mech-Vision and Mech-Viz. It runs the corresponding Mech-Viz project (which triggers the corresponding Mech-Vision project to run), and sets the initial joint positions of the simulated robot in Mech-Viz.

../../../../_images/start_mech_viz_13.png

Parameters

  • Input parameters

    Robot_Pose_Type

    The initial joint positions for the simulated robot in Mech-Viz, 0 or 1.

    0: Set the initial joint positions of the simulated robot to [0,0,0,0,0,0] 1: Set the initial joint positions of the simulated robot to the current joint positions of the real robot

    Robot_Pose

    The current joint poisions of the robot, as an array of 6 real numbers.

    Start_Viz

    Start the Mech-Viz project at the rising edge.

    Set_Edge

    Store the value of Start_Viz in the last cycle to prevent unnecessary repetition of triggering.

    Note

    When the scene contains object models that obstruct the robot to move from [0,0,0,0,0,0] to the first target, the value of Robot_Pose_Type must be set to 1.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    2103 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/start_mech_viz_23.png

When “Camera_User”.Start_Viz is at the rising edge, this example runs the corresponding Mech-Viz project, and sets the initial joint positions of the simulated robot to the current joint positions of the real robot.

Stop Mech-Viz Project

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

../../../../_images/stop_mech_viz_13.png

Parameters

  • Input parameters

    Stop_Viz

    Stop the execution of the Mech-Viz project at the rising edge.

    Set_Edge

    Store the value of Stop_Viz in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    2104 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/stop_mech_viz_23.png

When “Camera_User”.Stop_Viz is at the rising edge, this example stops the execution of the Mech-Viz project.

Select Mech-Viz Branch

This command is used to select along which branch the Mech-Viz project should proceed. Such branching is achieved by adding branch_by_msg Task(s) to the project. This command specifies which exit port such Task(s) should take.

Note

  • MM_Start_Viz must be executed BEFORE this command.

  • When the next Task to be executed in Mech-Viz is a branch_by_msg Task, Mech-Viz will wait for this command to send the exit port number it should take.

  • The name of all branch_by_msg Tasks in the Mech-Viz project must be changed to integers between 1 and 99, and the names should be unique among all Tasks in the project.

../../../../_images/set_branch_23.png

Parameters

  • Input parameters

    Branch_Name

    Name of the branch_by_msg Task, from 1 to 99.

    Branch_Exit_Port

    The number of the exit port to take, from 1 to 99.

    Add 1 to the port number displayed in Mech-Viz. E.g., value 1 corresponds to exit port 0 in Mech-Viz.

    Set_Branch

    Sets the branch to take at the rising edge.

    Set_Edge

    Store the value of Set_Branch in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    2105 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/set_branch_33.png

When “Camera_User”.Set_Branch is at the rising edge, this example tells Mech-Viz to take exit port 1 for the branch_by_msg Task named 1.

Set Move Index

This command sets the value for the Current Index parameter of Mech-Viz Tasks. Tasks that have this parameter include move_list, move_grid, custom_pallet_pattern, and smart_pallet_pattern.

Note

  • MM_Start_Viz must be executed BEFORE this command.

  • The name of all Tasks with index parameters in the Mech-Viz project must be changed to integers between 1 and 99, and the names should be unique among all Tasks in the project.

../../../../_images/set_index_23.png

Parameters

  • Input parameters

    Index_Name

    Task ID of the Task with the index parameter. The Task ID can be read in the Task’s parameters.

    Index_Counter

    The index value that should be set the next time this Task is executed.

    When this command is sent, the current index value in Mech-Viz will become the parameter value minus 1.

    When the Mech-Viz project runs to the task specified by this command, the current index value in Mech-Viz will be increased by 1 to become the parameter’s value.

    Set_Index

    The trigger signal to set the index. The rising edge does the trigger.

    Set_Edge

    Store the value of Set_Index in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    2106 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/set_index_33.png

When “Camera_User”.Set_Index is at the rising edge, this example sets the Current Index value to 3 for the Task named 5. When the Task is executed, the Current Index value will be added 1 and become 4.

Get Planned Path

This command obtains the planned path from Mech-Viz.

../../../../_images/get_mech_viz_date_13.png

Parameters

  • Input parameters

    Request_Pose_Type

    Whether Mech-Viz should send targets as joint positions or TCPs, 1 or 2.

    1: Mech-Viz sends joint positions 2: Mech-Viz sends TCPs

    Get_VizData

    Obtains the planned path from Mech-Viz at the rising edge.

    Set_Edge

    Store the value of Get_VizData in the last cycle to prevent unnecessary repetition of triggering.

    Attention

    The Request_Pose_Type parameter here and the Robot_Pose_Type parameters in the MM_Start_Vis and MM_Start_Viz FCs all correspond to the same Pose Type parameter in the MM Modbus TCP Interface DB. 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.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    2100 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

    Status of Pose Sent

    1 represents that the target data written in are new.

    After the PLC reads the pose data, please run the MM_Empty_Target FC to reset the register to 0.

    Number of Pose Sent

    Store the number of received targets, from 1 to 20.

    Index of Vision Move

    Store the position of the visual_move target in the path.

    Example path: move-1, move-2, visual_move-3, move-3 In this path, the position of the visual_move target is 3. If the path does not contain visual_move target, the return value is 0.

    Target Pose

    Store the received target poses.

    Target Label

    Store the integer labels corresponding to the poses. Labels are set in Mech-Vision.

    Speed Percentage

    Store the velocity settings corresponding to the poses.

Example

../../../../_images/get_mech_viz_date_23.png

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

Get DO List

This command obtains the planned DO signal list for controlling multiple sections of a sectioned vacuum gripper.

Note

  • MM_Get_Vizdata must be executed BEFORE this command.

  • Please configure the Mech-Viz project based on the template project in XXXX\Mech-Center-xxx\tool\viz_project\suction_zone, and set the suction cup configuration file in the Mech-Viz project.

../../../../_images/get_do_list_13.png

Parameters

  • Input parameters

    Get_DoList

    Obtains the planned DO signal list from Mech-Viz at the rising edge.

    Set_Edge

    Store the value of Get_DoList in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    2102 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

    DO_LIST

    The list of 64 DO values, in the range of 0 to 999, with -1 being the placeholder value.

Example

../../../../_images/get_do_list_23.png

When “Camera_User”.Get_DoList is at the rising edge, this example obtains the planned DO signal list from Mech-Viz and stores it in the DO_LIST variable.

Input Object Dimensions to Mech-Vision

This command inputs object dimensions to the Mech-Vision project.

Note

  • This command must be executed BEFORE MM_Start_Vis.

../../../../_images/read_object_dimensions_23.png

Parameters

  • Input parameters

    Vision_Proj_Num

    Mech-Vision Project ID, from 1 to 99.

    Can check and adjust in Mech-Center ‣ Deployment Settings ‣ Mech-Vision.

    External_Input_Box_Dimention

    The 3D dimensions (in mm) to be input to the Mech-Vision project, as an array of 3 real numbers.

    Set_Box_Dimention

    Input the object dimensions to the Read Object Dimensions Step in the Mech-Vision project at the rising edge.

    Set_Edge

    Store the value of Set_Box_Dimention in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    1108 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/read_object_dimensions_33.png

When “Camera_User”.Set_Box_Dimention is at the rising edge, this example sets the object dimensions in the Read Object Dimensions Step in the Mech-Vision project No. 1 to the values in External_Input_Box_Dimention.

Input TCP to Mech-Viz

This command inputs TCP data to the outer_move Task.

Note

  • This command must be executed BEFORE MM_Start_Viz.

  • Please configure the Mech-Viz project based on the template project in XXXX\Mech-Center-xxx\tool\viz_project\outer_move, and put the outer_move Task at a proper position in the workflow.

../../../../_images/set_pose_13.png

Parameters

  • Input parameters

    External_Input_Pose

    The TCP data to be input to Mech-Viz (in mm), as an array of 6 real numbers.

    Set_Input_Pose

    Input the TCP data to the outer_move Task in the Mech-Viz project at the rising edge.

    Set_Edge

    Store the value of Set_Input_Pose in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    2107 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/set_pose_23.png

When “Camera_User”.Set_Input_Pose is at the rising edge, this example sends the TCP data stored in External_Input_Pose to the outer_move Task in the Mech-Viz project.

Get Software Status

This command is currently capable of checking whether Mech-Vision is ready to run projects. In the future, this command can be used for obtaining the execution status of Mech-Vision, Mech-Viz and Mech-Center.

../../../../_images/get_software_state_13.png

Parameters

  • Input parameters

    Get_Status

    Check whether Mech-Vision is ready to run projects at the rising edge.

    Set_Edge

    Store the value of Get_Status in the last cycle to prevent unnecessary repetition of triggering.

  • Returned data in the MM Modbus TCP Interface DB

    • Status code

      Software status. 1101 means the Mech-Vision project is ready to run. Other codes mean the project is not ready.

Example

../../../../_images/get_software_state_23.png

When “Camera_User”.Get_Status is at the rising edge, this example checks the status code and stores it in the Status Code variable.

Clear Target Data

This command clears the obtained data stored in the Target Pose, Target Label and Speed Percentage variables.

../../../../_images/clear_target_data_11.png

Parameters

  • Input parameters

    Start_Empty

    Clear the data stored in the Target Pose, Target Label and Speed Percentage variables when value set to 1.

    Target_Pose

    Obtained target poses.

    Target_Label

    Obtained labels.

    Speed_Percentage

    Obtained velocity settings.

  • Returned data in the MM Modbus TCP Interface DB

    Status Code

    3103 is returned if no error occurred.

    For other values, please refer to Status Codes and Trouble Shooting for the corresponding error.

Example

../../../../_images/clear_target_data_21.png

When the value of “Camera_User”.Start_Empty is set to 1, the data stored in the Target Pose, Target Label and Speed Percentage variables in the MM Modbus TCP Interface DB are cleared.

Description of the Status Codes

Please refer to Status Codes and Trouble Shooting for detailed information.