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
Behavior during Simulation
This parameter is used to select the Step behavior during the project simulation.
-
Check external input
When the simulation project executes to this Step, the Step checks the external input and selects the corresponding exit port based on the DI.
-
Execute along specific exit port
Designate a specific exit port, and the simulation project will execute the branch after that exit port.
-
Select exit port manually
When the simulation project executes to this Step, a window will pop up for you to choose an exit port manually. Once selected, the project execution will continue.
An example is showed in the following figure.
Select an exit port in the dropdown menu of “Select exit port manually,” and then click OK. The project will continue to run the Steps.
Click Cancel or X to stop the simulation.
Number of Exit Port
This parameter is used to specify the number of exit ports for this Step.
-
To pause the project execution and resume upon the reception of an external command, set the number of exit ports to 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 number of exit ports to a value greater than 1. Please set the number of exit ports according to the number of branches in actual need.
The parameters display differently according to the changes of the number of exit ports. Please choose to read the corresponding section as needed.
Number of Exit Port=1
The following parameters can be set when Number of Exit Port 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
“Notify_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.
Number of Exit Port>1
The following parameters can be set when Number of Exit Port is greater than 1.
It is generally used to execute the corresponding branch flows based on the external commands.
When there are more than 5 exit ports, the ports will be combined for display. Press the Ctrl key and double-click the Step block to display all exit ports. The exit port numbers and the connected Steps will be displayed in the table below the Step parameter panel. |
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. |