Commands¶
The commands for communication between the Mech-Mind Software Suite and the Mech-Center Standard Interface Siemens PLC Client using the software TIA Portal are as follows:
Introduction¶
Mech-Center Standard Interface Siemens PLC Client¶
Mech-Center software supports communication via Siemens Snap7, and provides the standard interface option Siemens PLC Client as the client for data communication with the Mech-Mind interface.db data block in the PLC.
In deployment settings of Mech-Center, the Siemens PLC Client standard interface settings are as follows:
In the software PLC Portal, the contents of the Mech-Mind Interface data block are as follows:
Mech-Mind-Siemens TIA S7 Interface¶
The interface files include:
Mech-Mind Interface.db data block file for data communication.
Mech-Mind Interface Program.scl file, for implementing the functions of various interface commands.
Hint
File storage path: XXXX/Mech-Center-xxx/Robot_Interface/Siemens Snap7/TIA Portal under the file location of Mech-Center on the IPC or host of the Mech-Mind Vision System.
Please copy the file to a computer with the Portal software installed.
Commands¶
Start Mech-Vision Project¶
This command starts the running of the Mech-Vision project, which executes image capturing, and performs vision recognition.
If the project works in the eye-in-hand mode, the robot pose for image capturing needs to be transmitted by this command into the project.
This command is for scenarios using only Mech-Vision.
Parameters in command sent
Vision_Proj_Num
The integer ID number of the Mech-Vision project in Mech-Center, i.e., the number shown on the left of the project path in
in Mech-Center. Range: [1, 99]. The number can be adjusted by dragging the projects.Req_Pose_Num
The number of vision points (i.e., vision poses and their corresponding point clouds, labels, indices, etc.) to expect Mech-Vision to output.
0
Get all the vision points from the Mech-Vision project’s recognition results.
integers > 0
Get the specified number of vision points.
If the total number of vision points is smaller than the parameter value, all the available vision points will be returned.
If the total number of vision points is greater than or equal to the parameter value, vision points in the quantity of the parameter value will be returned.
Note
The command to obtain the vision points is Get Vision Target(s).
Robot_Pose_Type
This parameter indicates the type of the image-capturing pose of the real robot to input to Mech-Vision.
0
No robot pose needs to be transmitted by this command.
If the project works in the eye-to-hand mode, then image capturing has nothing to do with the robot’s pose, so no robot image-capturing pose is needed by Mech-Vision.
1
The robot pose transmitted by this command is in JPs.
2
The robot pose transmitted by this command is a flange pose.
Robot_Pose
This parameter is the robot pose needed when the project works in the eye-in-hand mode.
The robot pose is either in JPs or flange pose, according to the setting of the parameter “robot pose type”.
Data format: six REAL numbers.
Start_Vision
Trigger the start of the Mech-Vision project. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Start_Vision” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, status code 1102 will be returned. Otherwise, the corresponding error code will be returned.
Example
Get Vision Target(s)¶
This command gets the vision result, i.e., vision points, after executing command 101.
Parameters in command sent
Vision_Proj_Num
The integer ID number of the Mech-Vision project in Mech-Center, i.e., the number shown on the left of the project path in
in Mech-Center. Range: [1, 99]. The number can be adjusted by dragging the projects.Get_VisData
The signal to request the result from the Mech-Vision project. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Get_VisData” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
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
means the pose data written is new.After PLC reads the pose data, please reset this register;
Number of Pose Sent
The number of poses transmitted by executing the command “Get Vision Target(s)” this time.
Range: [1, 40].
Note
For Siemens PLC, by default, the upper limit of the number of poses transmitted by calling this command each time is 40. So, this command may need to be executed multiple times before all the poses in the vision result are returned.
Target Pose
The robot targets (as TCPs) converted from the vision results of the Mech-Vision project.
Target Label
The labels reflecting object info corresponding to the targets. The labels are integers.
Example
Switch Mech-Vision Recipe¶
This command switches the parameter recipe used by the Mech-Vision project.
In Mech-Vision, you can change the settings of a group of parameters by switching the parameter recipe.
Parameters involved in recipe switching usually include point cloud matching model, image matching template, ROI, confidence threshold, etc.
This command needs to be used before executing command 101 which starts the Mech-Vision project.
Parameters in command sent
Vision_Proj_Num
The integer ID number of the Mech-Vision project in Mech-Center, i.e., the number shown on the left of the project path in
in Mech-Center. Range: [1, 99]. The number can be adjusted by dragging the projects.Vision_Recipe_Num
The ID number of the parameter recipe to switch to, i.e., the number on the left of the parameter recipe name in
in Mech-Vision.Switch_Recipe
The trigger signal to switch the recipe. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Switch_Recipe” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, status code 1107 will be returned. Otherwise, the corresponding error code will be returned.
Example
Start Mech-Viz Project¶
This command is for scenarios using both Mech-Vision and Mech-Viz.
This command starts the running of the Mech-Viz project, calls the corresponding Mech-Vision project, and lets the Mech-Viz project plan the robot path based on the vision points from Mech-Vision.
For the Mech-Viz project that needs starting, the option Autoload needs to be checked in Mech-Viz’s interface.
Please see Example Mech-Viz Projects for Standard Interface for the description of example Mech-Viz projects.
Parameters in command sent
Robot_Pose_Type
0
The current pose of the robot is not needed by Mech-Viz and no pose will be sent.
If the project works in the eye-to-hand mode, no robot image-capturing pose will be needed by the project.
In Mech-Viz, the simulated robot will move from the initial pose JPS = [0, 0, 0, 0, 0, 0] to the first target in the planned path.
1
The robot pose will be sent to Mech-Viz and the pose sent is in JPS.
In Mech-Viz, the simulated robot will move from the input initial pose (i.e., the pose sent by this command) to the first target in the planned path.
TCP is not supported at present.
Note
If in the scene, there are barriers that stand in the way from the initial pose JPS = [0, 0, 0, 0, 0, 0] to the first target in the planned path, the pose type must be set to 1.
Robot_Pose
The current JPS of the real robot (if pose type is set to 1).
Data format: 6 numbers of REAL type.
Start_Viz
The signal to trigger the running of the Mech-Viz project. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Start_Viz” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, status code 2103 will be returned. Otherwise, the corresponding error code will be returned.
Example
Stop Mech-Viz Project¶
This command stops the running of the Mech-Viz project. This command is needed only when the Mech-Viz project fall into an infinite loop or cannot be stopped normally.
Parameters in command sent
Stop_Viz
The trigger signal to stop the running of the Mech-Viz project, the rising edge is valid;
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Stop_Viz” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, status code 2104 will be returned. Otherwise, the corresponding error code will be returned.
Example
Select Mech-Viz Branch¶
This command specifies which branch the project should run along. For this command, the branching is implemented by a “branch_by_msg” Task, and this command selects the branch by specifying an exit port of the Task.
Before executing this command, the Mech-Viz project needs to be started by executing command 201.
When the Mech-Viz project runs to the “branch_by_msg” Task, it will wait for command 203 to specify which exit port of the Task, i.e., the branch, the project should run along.
Parameters in command sent
Branch_Name
The Task ID of the branch_by_msg Task.
This parameter is for specifying which branch_by_msg Task the branch selection should apply to.
The Task ID can be read in the Task’s parameters.
Branch_Exit_Port
This parameter is for specifying which exit port of the specified Task, i.e., the branch, the project should run along. The value should be an integer ([1, N]).
Note
An exit port number is the 1-based index of the specified exit port on the Task. For example, if the specified exit port is the second exit port of the Task from left to right, the exit port number is 2.
Set_Branch
The trigger signal for setting the branch. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Set_Branch” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, status code 2105 will be returned. Otherwise, the corresponding error code will be returned.
Example
Set Move Index¶
This command is for setting the index parameter of a Task that involves sequential or separate motions or operations.
Tasks with index parameters include move_list, move_grid, custom_pallet_pattern, smart_pallet_pattern, etc.
Before executing this command, command 201 needs to be executed to start the Mech-Viz project.
Parameters in command sent
Index_Name
The Task ID of the branch_by_msg Task.
This parameter specifies which Task the index setting should apply to.
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
This parameter does not need to be set by the user.
It stores the value of “Set_Index” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, status code 2106 will be returned. Otherwise, the corresponding error code will be returned.
Example
Get Planned Path¶
This command gets the robot motion path planned by Mech-Viz after command 201 is executed to start the Mech-Viz project.
Note
If one of the targets in the path is not supposed to be sent to the robot, please clear the parameter “Send Target” checkbox of the corresponding move-type Task.
Parameters in command sent
Request_Pose_Type
This parameter specifies the type of path targets to return from Mech-Viz.
1
The targets returned should be in JPS.
2
The targets returned should be in TCP.
Get_VizData
The trigger signal to obtain the planned path from Mech-Viz. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Get_VizData” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, status code 2100 will be returned. Otherwise, the corresponding error code will be returned.
Note
When executing this command, if Mech-Viz has not yet had the planned robot motion path (the project is still running), Mech-Center will wait. The default wait time is 10 seconds. If a timeout occurs, a timeout error code will be returned.
Status of Pose Sent
1 means that the written pose data is new data. After PLC reads the pose data, please reset this register;
Number of Pose Sent
This parameter indicates the number of path targets ([pose, label, velocity]) sent by executing this command this time.
Default range: 0 to 40.
Note
In Siemens PLC, by default, executing command 205 once can fetch at most 40 targets (poses, labels, velocities) at a time. If the number of targets is greater than 40, please execute command 205 multiple times.
Index of Vision Move
The position of the visual_move Task, i.e., the move to the vision pose (usually the pose for picking the object) in the entire robot motion path.
For example, if the path is composed of Tasks move_1, move_2, visual_move, move_3 sequentially, the position of visual_move is 3.
If in the path there is no visual_move Task, the returned value will be 0.
Target Pose
The poses of the targets in the planned path.
Each pose includes Cartesian coordinates (XYZ) and Euler angles (ABC), or JPS, according to the target type set by this command.
Target Label
The labels of the targets in the planned path.
A label is the integer label assigned to a pose. If in the Mech-Vision project, the labels are strings, they need to be mapped to integers before outputting from the Mech-Vision project using Step Label Mapping. If there are no labels in the Mech-Vision project, the label defaults to 0.
Speed Percentage
The velocities of the targets in the planned path.
A velocity is the non-zero velocity parameter percentage value for the corresponding move-type Task in Mech-Viz.
Example
Get DO List¶
This command gets the planned DO signal list when there are multiple grippers, such as suction cup sections, to control.
The command “Get Planned Path” needs to be executed before executing this command.
For using this command:
In the parameters of the “set_do_list” Task:
Check “StandardInterface” under “Receiver”
Check “Get DO List from VisualMove”
Select a “visual_move” Task that needs the DO signal list at the bottom of the parameter panel
Hint
Please refer to the Mech-Viz template project in XXXX\Mech-Center-xxx\tool\viz_project\suction_zone, and set the corresponding suction cup configuration file in the project before running.
Parameters in command sent
Get_DoList
Trigger signal for obtaining the DO signal list. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Get_DoList” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, 2102 will be returned. Otherwise, the corresponding error code will be returned.
DO
The sixty-four DO signal values returned by executing this command. A valid DO value is in the range of [0, 999], and -1 is a placeholder value.
Example
Input Object Dimensions to Mech-Vision¶
This command is for dynamically inputting object dimensions to the Mech-Vision project, and has to be executed before executing MM_Start_Vis.
Parameters in command sent
Vision_Proj_Num
The integer ID number of the Mech-Vision project in Mech-Center, i.e., the number shown on the left of the project path in
in Mech-Center. Range: [1, 99]. The number can be adjusted by dragging the projects.External_Input_Box_Dimention
The 3D dimensions to input to the Mech-Vision project.
Unit: mm
Data type: Array[0–2] of Real
Set_Box_Dimention:
The trigger signal to input the dimensions. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Set_Box_Dimention” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, 1108 will be returned. Otherwise, the corresponding error code will be returned.
Example
Input TCP to Mech-Viz¶
This command is for dynamically inputting robot TCP data to Mech-Viz to work with Task “external_move” in Mech-Viz.
Hint
This function needs to be used with the project at XXXX\Mech-Center-xxx\tool\viz_project\outer_move, for which Task “outer_move” needs to be
Parameters in command sent
External_Input_Pose
The parameter stores the TCP data to be sent to Mech-Viz.
Data type: Array[0–5] of Real
Set_Input_Pose
The trigger signal for inputting the TCP data. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Set_Input_Pose” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
If there is no error, 2107 will be returned. Otherwise, the corresponding error code will be returned.
Example
Get Software Status¶
This command is for obtaining the running status of Mech-Vision, Mech-Viz, Mech-Center (at present, only whether Mech-Vision is ready to start running the project can be checked).
Parameters in command sent
Get_Status
The trigger signal for checking whether Mech-Vision is ready to start running the project. The rising edge does the trigger.
Set_Edge
This parameter does not need to be set by the user.
It stores the value of “Get_Status” in the last scan cycle to prevent unnecessary repetition of triggering.
Parameters in data returned
Status code
Software status. 1101 means the Mech-Vision project is ready to run. Other codes mean the project is not ready.
Example
Clear Target Data¶
This command is for clearing the acquired data in Target Pose, Target Label, Speed Percentage.
Parameters in command sent
Start_Empty
The trigger signal to clear the obtained data in Target Pose, Target Label, Speed Percentage. The signal takes effect when it is set high.
Target_Pose
This parameter stores the obtained target pose data.
Target_Label
This parameter stores the obtained target labels.
Speed_Percentage
This parameter stores the obtained non-zero speed parameters of targets.
Example