Common blocks
Last updated
Last updated
The list of available blocks depends on the chosen robotics kit and on the robot model (real robot or 2D model simulation). Blocks unavailable for the current kit are not shown at all, and blocks inaccessible for this model within the same platform are shown in gray and are not available for dragging onto the scene.
Common blocks for all platforms are presented below. A program using only these blocks will be executed on any platform without any changes.
A list of blocks specific to a particular robotics kit can be found in the relevant sections:
Icon | Name | Description |
The starting point for program execution. Each diagram should have only one such block. There should not be any incoming links in it, and there should be only one outgoing link from this element. The process of diagram interpretation begins with this block. | ||
End of the program. If the program consists of several parallel execution sections, reaching this block completes the corresponding execution section. This block cannot have outgoing links. | ||
A block for declaring a new variable and setting a value for it. | ||
Separation of program execution in accordance with a given condition. | ||
Indicates merging of two branches of a conditional statement. It does not perform any actions but is useful for ensuring the structure of the program. | ||
A loop that is executing so far some condition is true, indicated before it begins. This condition is checked before the loop body is executed, so the body may not be satisfied even once (if the condition is false from the very beginning). | ||
Block that provides the execution of a sequence of blocks several times. | ||
A condition with several alternatives. | ||
Counts the value of the specified expression. Initialization of variables is also allowed. | ||
Subprogram execution. | ||
Block divides program execution into several threads. | ||
Block merging parallel tasks. | ||
Finishes the task with the identifier specified in the "Task" property. Must be applied from another task. | ||
A block for assigning a specified variable to a random integer from a given interval. | ||
Block for adding arbitrary text to the diagram as a comment. | ||
Block for setting the delay. The delay time is set in the Delay parameter in milliseconds. | ||
Start drawing with a marker of a given color on the floor. When the robot moves in a two-dimensional model, a colored line will remain behind it. | ||
Finish drawing with a marker. |
The starting point for program execution.
Each diagram should have only one such block. There should not be any incoming links in it, and there should be only one outgoing link from this element.
The process of diagram interpretation begins with this block.
End of the program.
If the program consists of several parallel execution sections, reaching this block completes the corresponding execution section.
This block cannot have outgoing links.
A block for declaring a new variable and setting a value for it. The same operation can be performed using the Expression block, but this block makes the program more clear.
Property | Description |
Value | An expression is specified that defines the initial value of the variable. |
Variable | The variable name is specified. |
Separation of program execution in accordance with a given condition.
This block must have two outgoing connections, at least one of which must have the value of the Condition parameter set: true or false.
Property | Description |
Condition | A logical expression is indicated (for more details, see the article "Expression Syntax"), based on the value of which the further path of the diagram execution will be selected. |
Indicates merging of two branches of a conditional statement. It does not perform any actions but is useful for ensuring the structure of the program.
It does not perform any actions but is useful for ensuring the structure of the program. If you adhere to the rule that all branches of the "Condition" or "Switch" operators converge on such a block, this will significantly increase the chances that the generator will be able to generate code in text language without goto
statements.
A loop with a precondition is a loop that is true so far for some condition specified before it starts. This condition is checked before the loop body is executed, so the body may not be satisfied even once (if the condition is false from the very beginning).
Property | Description |
Condition | The logical expression is specified (for more details, see the article "Syntax of expressions"), based on the value of which the further path of the diagram interpretation will be selected. |
Block that provides the execution of a sequence of blocks several times.
The number of repetitions is set by the value of the Iteration parameter. The block must have two outgoing connections, one of which must be marked with the value “body” (that is, the value of the “Condition” parameter the connection must have “body”). Another connection coming from the “Cycle” block should remain unmarked: it will go through when the program passes through the “Loop” block the specified number of times.
Infinite loops and loops of the form while / do
and while
are organized without using this block, looping the control flow using links. An exit from such a loop is carried out using the “Condition” block.
A condition with several alternatives.
In the "Expression" parameter, you can specify an arbitrary expression (for more details, see the section "Syntax of expressions"), based on the value of which the further path of the diagram interpretation will be selected.
This block must have several outgoing links. All relations, except one, should be marked with an elementary value (string, number, etc.), which can take an expression (the value is simply written in the Condition property of the connection). One of the links should not be marked: it jumps if the expression is not equal to any of the listed values.
Evaluate the value of the specified expression. Initialization of variables is also allowed.
For more information about the syntax of valid expressions for the Expression parameter, see the section "Expression syntax".
Subprogram execution. Subprograms are used to keep repeating program fragments on a separate diagram. When adding this block to the diagram, you will be prompted to enter the name of the subprogram, after which double-clicking on the block will be able to go to the diagram corresponding to this subprogram. An additional palette with all the subprograms will also appear. Subprograms from it can be dragged onto the scene and used as normal blocks. The appearance, name, and properties of the block can be changed using the context menu.
Changing the properties of this block does not perform in the "Properties Editor" panel, but using the "Change Properties" item in the context menu. To call the context menu, right-click on the block "Subprogram".
In the window that opens, you can:
Change subprogram name.
Add and change subprogram parameters by specifying a name, type, and value.
Change the picture on the icon of your subprogram.
Change subprogram icon background.
A block divides program execution into several threads. For example, you can simultaneously wait for the sensor to trigger and the time interval to expire.
A block must have at least two outgoing connections.
In order to be able to further refer to parallel tasks generated by this block (for example, in the "Kill thread" block or in the "Join" block), you need to give the names of the tasks. This is done on outgoing connections, in the Condition property. The name of the task can be any string, but one of the names should be the name of the task that is included in this block. The name of the main program is main
.
Block for merging parallel tasks.
It blocks the execution of the program until the execution of all parallel tasks included in this block reaches this block.
A block must have at least two incoming links. On the outgoing connection (in the “Condition” property) there must be an identifier for the task, which will continue after the block has completed.
Finishes the task with the identifier specified in the "Task" property. Must be applied from another task.
A block for assigning a specified variable to a random integer from a specified interval using the From and To properties.
Block for adding arbitrary text to the diagram as a comment.
Used to explain a specific block or section of a diagram. May be associated with the block, which he explains.
When the program is executed, the block is not taken into account.
Block for setting the delay. The delay time is set in the Delay parameter in milliseconds.
Start drawing with a marker of a given color on the floor. When the robot moves in a two-dimensional model, a colored line will remain behind it.
The block is available only in the two-dimensional model mode.
Finish drawing with a marker.
The block is available only in the two-dimensional model mode.