LogoLogo
TRIK StudioTRIKLego EV3Lego NXT
English
English
  • TRIK help
  • TRIK Studio
    • About TRIK Studio
      • How to find out the version of TRIK Studio
    • Getting started and creating a project
    • TRIK Studio interface
      • TRIK Studio main menu
      • Working with graphs
      • How to open robot settings
      • How to change TRIK Studio interface language
    • TRIK Studio settings
    • 2D model
      • 2D model tuning
      • Adding restrictions to the 2D Model
        • Restrictions setting examples
    • Visual programming
      • Adding and removing blocks
      • Common blocks
      • Links between blocks
      • Syntax of expressions in the blocks
        • TRIK Studio language types
          • Array
        • TRIK Studio language tokens
        • TRIK Studio language operators
        • Constants
        • Sensor variables
        • Built-in functions
      • Property editing
      • Subprograms
    • Textual programming
    • Exercises
    • External tools
      • PuTTY
      • WinSCP
    • TRIK Studio shortcuts
    • Antivirus conflicts
      • Avast antivirus blocks TRIK Studio. What to do?
  • TRIK Studio Junior
    • About TRIK Studio Junior
      • How to find out the version of TRIK Studio Junior
    • Getting started and creating a project in TRIK Studio Junior
    • TRIK Studio Junior interface
      • How do I replace the "Character movement" image?
    • TRIK Studio Junior settings
    • Visual programming in TRIK Studio Junior
      • Adding and removing blocks in TRIK Studio Junior
      • Blocks in TRIK Studio Junior
      • Links between blocks in TRIK Studio Junior
      • Syntax of expressions in the blocks in TRIK Studio Junior
      • Property editing in TRIK Studio Junior
      • Subprograms in TRIK Studio Junior
    • Exercises in TRIK Studio Junior
  • INTEGRATIONS
    • PyCharm
      • Running a 2D model in TRIK Studio from PyCharm
    • Sublime Text
      • Running a 2D model in TRIK Studio from Sublime Text
      • Uploading programs to several TRIK robots from Sublime Text
    • VSCode
      • Running a 2D model in TRIK Studio from VSCode
      • Uploading programs to several TRIK robots from VSCode
  • TRIK controller
    • About the TRIK controller
      • Screenshot of the TRIK controller screen
    • TRIK controller firmware
      • How to find out the firmware version of the TRIK controller?
    • TRIK controller menu
    • Connecting to the TRIK controller via Wi-Fi
      • Connecting the TRIK controller to a computer and smartphone
      • Connecting the TRIK controller to TRIK Studio
      • Interaction of TRIK controllers
        • An example of solving a problem on the interaction of two robots
    • Connecting to the TRIK controller using UART
    • Launching and uploading programs to the TRIK controller
    • Programming TRIK with the visual programming language
      • TRIK specific blocks
      • Sensory variables for the TRIK controller
    • TRIK controller programming in Python and JavaScript
      • Object «brick»
        • Class «accelerometer»
        • Class «battery»
        • Class «colorSensor»
        • Class «display»
        • Class «encoder»
        • Class «gyroscope»
        • Class «keys»
        • Class «led»
        • Class «lineSensor»
        • Class «motor»
        • Class «objectSensor»
        • Class «sensor»
      • Object «script»
      • Object «mailbox»
      • Object «gamepad»
      • Object «Threading»
      • Function getPhoto
      • Function include
    • TRIK controller web interface
    • Connecting devices to TRIK and working with them
      • Connecting and working with the video module
      • Testing devices connected to the TRIK controller
      • Configuring the operation of a USB camera with a TRIK controller
      • Capturing images with TRIK camera and using them in TRIK Studio
      • Working with battery and charger
  • LEGO EV3 Controller
    • About LEGO EV3
    • Connecting a LEGO EV3 Controller to TRIK Studio
    • LEGO EV3 specific blocks
    • Sensory Variables for the LEGO EV3 Controller
    • Launching and uploading programs to the LEGO EV3
  • LEGO NXT Controller
    • About LEGO NXT
    • LEGO NXT Controller Firmware
    • Connecting a LEGO NXT Controller to TRIK Studio
    • LEGO NXT specific blocks
    • Sensory Variables for the LEGO NXT Controller
    • LEGO NXT C Programming
    • Launching and uploading programs to the LEGO NXT
  • Quadcopter Geoscan Pioneer
    • About quadcopter Geoscan Pioneer
    • Geoscan Pioneer specific blocks
  • TRIK Gamepad
    • About TRIK Gamepad
      • TRIK Gamepad App
      • TRIK Gamepad Utility
    • Robot control from the remote control
  • Feedback
    • Actions in case of TRIK Studio or TRIK controller malfunction
    • Ask a Question
    • trikset.com
Powered by GitBook
On this page
  • List of common blocks
  • Initial Node
  • Final Node
  • Variable Initialization
  • Condition
  • End if
  • Pre-conditional Loop
  • Loop
  • Switch
  • Expression
  • Subprogram
  • Fork
  • Join
  • Kill thread
  • Random Initialization
  • Comment
  • Timer
  • Marker Down
  • Marker Up

Was this helpful?

Export as PDF
  1. TRIK Studio
  2. Visual programming

Common blocks

PreviousAdding and removing blocksNextLinks between blocks

Last updated 4 years ago

Was this helpful?

The list of available blocks depends on the chosen robotics kit and on the robot model (real robot or ). 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 .

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:

List of common blocks

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.

Initial Node

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.

Final Node

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.

Variable Initialization

Properties

Property

Description

Value

An expression is specified that defines the initial value of the variable.

Variable

The variable name is specified.

Condition

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.

Properties

Property

Description

Condition

End if

Pre-conditional Loop

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).

Properties

Property

Description

Condition

Loop

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.

Switch

A condition with several alternatives.

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.

Expression

Evaluate the value of the specified expression. Initialization of variables is also allowed.

Subprogram

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.

Properties

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.

Fork

Join

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.

Kill thread

Finishes the task with the identifier specified in the "Task" property. Must be applied from another task.

Random Initialization

A block for assigning a specified variable to a random integer from a specified interval using the From and To properties.

Comment

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.

Timer

Block for setting the delay. The delay time is set in the Delay parameter in milliseconds.

Marker Down

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.

Marker Up

Finish drawing with a marker.

The block is available only in the two-dimensional model mode.

A block for declaring a new variable and setting a value for it. The same operation can be performed using the block, but this block makes the program more clear.

A logical expression is indicated (for more details, see the article ""), 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 "" or "" 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.

The logical expression is specified (for more details, see the article ""), based on the value of which the further path of the diagram interpretation will be selected.

In the "Expression" parameter, you can specify an arbitrary expression (for more details, see the section ""), based on the value of which the further path of the diagram interpretation will be selected.

For more information about the syntax of valid expressions for the Expression parameter, see the section "".

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 "" block or in the "" 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.

TRIK
LEGO EV3
LEGO NXT
Geoscan Pioneer Quadcopter
Syntax of expressions
Expression syntax
Expression
Condition
Switch
Kill thread
Join
Expression Syntax
Syntax of expressions
Initial Node
Final Node
Variable Initialization
Condition
End if
Pre-conditional loop
Loop
Switch
Expression
Subprogram
Fork
Join
Kill thread
Random Initialization
Comment
Timer
Marker Down
Marker up
2D model simulation
scene
Initial Node
Final Node
Variable Initialization
Condition
End if
Pre-conditional Loop
Loop
Switch
Expression
Subprogram
Fork
Join
Kill thread
Random Initialization
Comment
Timer
Marker Down
Marker Up