TRIK specific blocks consist of three categories:
Actions - blocks that perform any action on the controller: turning on the motors, playing sounds, etc.
Waiting - blocks waiting for an event to occur: certain sensor readings, pressing a button, etc.
Drawing - blocks displaying graphics and text on the screen.
For blocks common for all platforms see the article
Sends the message to a parallel task with a specified identifier (the identifier must be specified while creating the task in the "Fork" block).
The message can be arbitrary.
Assigns the pressed button code to a specified variable.
The "Waiting" property allows you to wait for the button to be pressed. If the button is not pressed, the variable will be set to -1.
Plays a sound with specified frequency and duration on the controller.
Plays an audio file on the controller.
The file must be pre-loaded on the controller. The path to the file is relative to the trik
folder on the controller. You can download the file to the controller, for example, using the WinSCP program.
Turn on the motors on the given ports with the given power.
The ports are specified by lines M1, M2, M3, and M4, separated by commas. The power specified as a percentage by a number from -100 to 100. If the value is negative, the motors will be reversed.
Turn on the motors in reverse mode on the given ports with the given power.
Parameters are similar to the "motors forward" block.
Stop the motors on the specified ports.
The ports are specified by lines M1, M2, M3, and M4, separated by commas.
Reset the motors revolutions count on the specified ports.
The ports are specified by lines E1, E2, E3, and E4, separated by commas.
Set the servos rotation angle on the specified ports to the specified position (from -90 to 90 degrees).
The ports are specified by comma separated values.
Use the speaker to say the phrase passed as the block argument.
Set the specified LED color on the controller.
The block has a logical parameter "Code". If it's True, the content of the "Command" parameter translates directly into the program code. Otherwise, an OS' CLI call will be pulled.
Enable the video camera on the controller in one of three modes:
Line Sensor - detects a color line in the center of the frame and subsequently returns the deviation of the center of the line from the center of the frame as a number in the range from -100 (left) to 100 (right).
Object sensor - detects a contrasting object in the center of the frame and later returns the coordinates of its center and diameter in pixels.
Color sensor - returns the dominant color in the center of the frame as its coordinates in the RGB color scale.
Captures the image in the center of the frame and initializes a line sensor or object sensor with it. The camera must be switched on in the appropriate mode with the "Initialize Camera" block.
Places the current line sensor reading in the specified variable.
The camera must be switched on inline sensor mode by the "Initialize Camera" block and initialized by the "Detect by camera" block.
Starts a video broadcast on the robot.
The video can be viewed on the TRIK control panel or in a browser at the address
{robots ip-address}:8080/?action=stream/
.
Sends the message to the robot with the board number specified.
The robot must be on the same network as the robot sending the message and registered as master or slave using Settings → Messages
on the robot. If there is more than one robot with the given board number in the network, all of them will receive the message.
Writes the given expression to a file.
The path can be absolute or relative to the folder containing trik-studio.exe
.
The file can be retrieved from the controller, e.g. with the WinSCP program for Windows or SCP for Linux.
Deletes a file.
The path can be absolute or relative to the folder containing trik-studio.exe
.
Turn off the camera.
Stop the video feed from the robot's camera.
Sets the gyroscope angle to zero at the current position..
Wait for a message from another parallel task.
The message text will be assigned to the specified variable.
The "Wait for message" property allows you to specify what to do if the message queue is empty: wait for a new message to arrive or continue working by assigning an empty string to the variable.
The message is automatically converted to the same type as the receiver variable. For example, if you send a number as a string, it will be accepted as a number.
Wait for the user to enter a value. The value will be assigned to the specified variable.
The block has three properties:
Example
Wait until the value returned by the gyro sensor on the specified port is greater or less than the one specified in the "degrees" parameter..
Wait for the touch sensor to operate on the specified port.
Wait until the value returned by the light sensor on the specified port is greater or less than the one specified in the "percents" parameter. Parameters:
"Percents" - value to compare with the value returned by the light sensor.
"Port" - the port to which the light sensor is connected.
"Read value" - the operation that will be used to compare with the value of the "Percents" parameter.
Wait until the distance returned by the ultrasonic distance sensor is greater or less than the one specified in the "distance" parameter (distance is set in centimeters, from 0 to 300).
Parameters:
"Distance" - value to compare with the value returned by the distance sensor.
"Port" - the port to which the distance sensor is connected.
"Read value" - the operation to be used for comparison with the value of the Distance parameter.
Wait until the distance returned by the infrared distance sensor is greater or less than the one specified in the "distance" parameter.
By default, the distance on ports A1 and A2 is set in centimeters (from 0 to 100). It is not recommended to connect other sensors to these ports as incorrect values may be read.
Another parameter is the number of the port to which the distance sensor is connected. The last parameter specifies the operation to be used for comparison with the distance.
Wait until the revolutions count reading on the specified port is greater or less than the Tacho limit value.
Wait until the specified button on the robot is pressed.
Wait for the message in the mailbox. When the message is received, it will be assigned to the specified variable.
The Wait for message property allows you to specify what to do if the message queue is empty: wait for a new message to arrive or continue working by putting an empty string into the variable.
The message is automatically converted to the type corresponding to the receiver variable type, i.e. you can, for example, send a number as a string and accept it as a number.
Wait for the button to be pressed on the remote control connected to the robot. The buttons are numbered from 1 to 5.
Wait for one of the two active areas of the RC to be pressed. The coordinates of the click can be obtained with the "gamepadPad" sensory variables.
Wait for the desired tilt of the RC.
The tilt is only registered if the remote is in "steering" mode, the tilt angle is coded with numbers from -100 (maximum left) to 100 (maximum right).
Another parameter specifies the operation that will be used to compare with the Angle parameter value.
Wait until the RC is disconnected from the robot. If the RC is not connected, the program will continue running.
Wait for the RC to connect to the robot. If the RC is already connected, the program will continue running.
Specify the color to draw simple graphical shapes on the robot's screen.
Specify the width of the line used to draw simple graphical figures on the robot's screen.
Draw a dot on the screen at the specified coordinates.
Draw a line segment on the screen. Segment ends are given as parameters to the block.
Draw a rectangle on the screen. The coordinates of the upper left corner, the width, and the height of the rectangle are specified as parameters.
Draw an ellipse inscribed in a given rectangle on the screen.
Draw an arc on the screen, given the coordinates of the rectangle in which it will be inscribed, and the angles (in degrees) of its beginning and end on the circle. If the beginning and the end coincide, the circle will be drawn.
Draw a smiley face on the screen.
Draw a sad smiley face on the screen.
Sets the screen background color.
Prints the specified string at the specified location on the robot's screen.
To print a text:
Put your text into the Text property.
Uncheck the Evaluate checkbox.
To print a variable value:
Put the variable name into the Text property.
Check the Evaluate checkbox.
Erase everything that is drawn on the screen.
Property
Description
Variable
Variable name.
Default
Default variable value.
Text
Text field description.
Property
Value
Evaluate
True — print the variable or expression value.
False — print as text.
Text
Text or variable/expression to be printed.
Redraw
True — redraw the screen. False — do not redraw.
X, Y
The text beginning coordinates.
Icon
Name
Description
Sends the message to the parallel thread with the identifier given.
Saves the code of the button pressed on the robot to the specified variable.
Plays a sound with specified frequency and duration on the controller.
Play the specified sound file on the controller.
Turn on the motors at the specified ports with the specified power.
Turn on the motors in reverse mode at the specified ports with the specified power.
Turn off the motors at the specified ports.
Reset the motors revolutions count for the specified ports.
Set the servos rotation angle on the specified ports to the specified position.
Speak through the speaker the phrase passed as an argument.
Set the specified controllers LED color.
The block has a logical parameter "Code". If it's True, the content of the "Command" parameter translates directly into the program code. Otherwise, an OS' CLI call will be pulled.
Turn on the video camera on the controller in one of the three modes.
Turn off the camera.
Fixes the image in the center of the frame and initializes the line sensor or object sensor with it.
Places the current line sensor reading into the specified variable.
Starts a video broadcast on the robot.
Stops the video feed from the robot's camera.
Sends the message to the robot with the board number specified.
Writes a given message to a file.
Deletes a file.
Sets the gyroscope angle to zero at the current position.
Icon
Name
Description
Wait for a message from another parallel task.
Wait for the user to enter a value.
Wait until the value returned by the gyro sensor on the specified port is greater or less than the one specified in the "degrees" parameter.
Wait for the touch sensor to operate on the specified port.
Wait until the value returned by the light sensor on the specified port is greater or less than the one specified in the "percents" parameter.
Wait until the distance returned by the ultrasonic distance sensor is greater or less than the one specified in the "distance" parameter..
Wait until the distance returned by the infrared distance sensor is greater or less than the one specified in the "distance" parameter..
Wait until the revolutions counter reading on the specified port is greater or less than the "Tacho limit" value.
Wait until the specified button on the robot is pressed.
Wait for the message in the mailbox. When the message is received, it will be assigned to the specified variable.
Wait for the button to be pressed on the remote control connected to the robot.
Wait for one of the two active areas of the RC to be pressed.
Wait for the desired tilt of the RC.
Wait until the RC is disconnected from the robot. If the RC is not connected, the program will continue running.
Wait for the RC to connect to the robot. If the RC is already connected, the program will continue running.
Block
Execution
Icon
Name
Description
Specify the color to draw simple graphical shapes on the robot's screen.
Specify the line width used to draw simple graphical figures on the robot's screen.
Draw a dot on the screen at the specified coordinates.
Draw a line segment on the screen. Segment ends are given as parameters to the block.
Draw a rectangle on the screen. The coordinates of the upper left corner, the width, and the height of the rectangle are specified as parameters.
Draw an ellipse inscribed in a given rectangle on the screen.
Draw an arc on the screen, given the coordinates of the rectangle in which it will be inscribed, and the angles (in degrees) of its beginning and end on the circle. If the beginning and the end coincide, the circle will be drawn.
Draw a smiley face on the screen.
Draw a sad smiley face on the screen.
Set the screen background color.
Print the specified string at the specified location on the robot's screen. The default value of the "Text" property is interpreted as a pure string, so it will be displayed that way.
Erase everything that is drawn on the screen.