Branch by Msg
Function
This Step is used to wait for the external commands and execute different branch flows according to the commands.
The cache of the “Branch by Msg” Step forms a queue. For example, after the “Branch by Msg” Step receives command 0 and it has not executed the command, it receives command 1 afterwards. When the Step is run, command 0 will be executed first, and 1 will be executed in the next run. In addition, all cached commands will be cleared at the end of the run. |
Usage Scenario
-
Execute different branch flows according to the external commands.
-
Pause the project execution and resume it until an external command is received.
Parameter Description
General Parameters of Non-Move Steps
Skip Execution
None |
Default setting. Do not skip the current Step. |
Simulation only |
Skip the current Step during simulation. The exit port is specified by Out Port When Skip. |
Always |
Skip the current Step when the project is simulating or running. The exit port is specified by Out Port When Skip. |
Instruction |
When Simulation only or Always is selected, the current Step will be skipped and the subsequent Step will be executed when running the project. If this parameter is set to None in “Check DI” Step in the project, and there is no external input signal during simulation, the project will be stopped when executing to this Step. In this case, setting the parameter to Simulation only or Always enables the simulation to continue. |
Out Port When Skip
This parameter will take effect when Skip Execution is set to Simulation only or Always. It specifies the exit port when skipping a Step.
Out Port Count
This parameter is used to specify the out port count of this Step.
-
To pause the project execution and resume upon the reception of an external command, set the out port count=1. In this way, the subsequent flow continues to be executed after the “Branch by Msg” receives an external command.
-
To execute the corresponding branch flows according to different external commands, set the out port count to a value greater than 1. Please set the out port count based on the number of branches in actual need.
The parameters display differently according to the changes of out port count. Please choose to read the corresponding section as needed.
Out Port Count=1
The following parameters can be set when Out Port Count is 1.
It is generally used to interrupt the project execution. The subsequent flow continues to be executed after the “Branch by Msg” receives an external command.
Affect Subsequent Move (Will Interrupt Planning)
This Step will interrupt the planning by default, that is, the planning will end at this Step and the planning based on subsequent workflow will resume after an external command is received.
Planning: The process when the software attempts to find a collision-free path that the robot can follow to reach the target position. |
Wait Timeout
If selected, a timeout exit port is added, and you can set the Wait Timeout parameter.
When the wait time for the external command exceeds the set Wait Timeout value, the timeout exit port will be taken.
Application Examples
“Notification_1” sends messages to Adapter, which collects required information and calculates the result. Adapter then inputs the result to the corresponding Step, and informs “Branch by Msg_1” to continue to run.
The timing of collecting the underlying information used for the calculations is uncertain. Therefore, there is a need to ensure that all information is up to date. In addition, the Step that receives the result of the Adapter’s calculation involves a change in the state. So it is necessary to ensure that the Step receives the result before proceeding with planning. Therefore, “Branch by Msg” is needed to interrupt the planning.
Out Port Count>1
The following parameters can be set when Out Port Count is greater than 1.
It is generally used to execute the corresponding branch flows based on the external commands.
Pre Plan Out Port
To ensure the continuity of planning, it is necessary to specify the pre plan out port. The branch with the highest possibility is generally specified to reduce the probability of re-planning and reduce robot wait time.
When this parameter is set as non-out port with the default value being -1, it means that pre plan out port is not specified.
Wait Timeout
If selected, a timeout exit port is added, and you can set the Wait Timeout parameter.
When the wait time for the external command exceeds the Wait Timeout value, the timeout exit port will be taken.
Application Examples
In the Standard Interface communication, use Branch by Msg to call different vision projects.
Take a TCP/IP command for example, if the Step ID of the “Branch by Msg” is 1, then the branch flow after exit port 0 will be executed when command 203,1,1 is sent; the branch flow after exit port 1 will be executed when command 203,1,2 is sent; and so on.
For detailed information of Standard Interface commands, please refer to Command 203—Set Exit Port for Branch by Msg in Mech-Viz. |