TRIK Studio overview

Anastasiia Kornilova
9 min readDec 22, 2020

Cutting edge robotics programming environment

In the era of STEM prosperity in curricular and extracurricular activities, robotics takes the central place as the most practical application of programming, mathematics, engineering, and physics. Choosing a comfortable, educational tool for such a wide-area becomes crucial for teachers to provide a deserving educational process.

Simulator in TRIK Studio

Today we will talk about TRIK Studio — a robotics programming environment with simulation for students of schools and universities, free, open-source, and cross-platform. TRIK Studio is a promising tool providing a convenient way to switch from visual programming (Scratch-like languages) to programming on the industrial textual languages, like Python/JavaScript, etc. TRIK Studio supports a wide range of the kits: Lego Mindstorms EV3, Lego Mindstorms NXT 2.0, TRIK, and Geoscan Pioneer quad-copter and provides an opportunity to run and debug developed algorithms in a 2D virtual environment. The latter is a massive advantage in remote (online) education that becomes a part of our life nowadays and an excellent opportunity to continue the education process outside of classes — at home.

In the current overview, we will discuss the main features of TRIK Studio with live examples — starting from the basic usage and finishing with powerful tools that are actively used in mass online competitions.

https://trikset.com/

Quick start

TRIK Studio is a cross-platform robotics programming environment supported on Windows, Linux, and macOS, absolutely free and actively supported. Here you can find a link to download the version for your OS.

After installation, open TRIK Studio and create a new program. On the left side, you will see Editor and Debug modes — the two main things you need to start program robots. The Editor serves to create a new program for your robot, whereas Debug is a 2D virtual environment supporting static objects like walls, moving objects such balls and cans, and visible and invisible floor drawings, where your program will be executed.

Editor and Debug modes of TRIK Studio. Editor presents Scene to put blocks for visual programming, Debug — scene with robot which is simulation environment

Visual programming

Visual programming provides the easiest and effective way to comprehend programming for beginner students, even with no experience. In TRIK Studio, Editor mode presents a scene where you can drag and drop blocks from the Palette — that will be bricks of your program.

Basic example

To demonstrate TRIK Studio visual programming’s elegance and simplicity, let’s create a short program with a robot moving forward for 5 seconds.

  1. Every program should have “Initial” and “Final” blocks, so drag them to the scene.
  2. To initiate the robot movement, we need to supply power to motors, so put the “Motors forward” block on the scene.
  3. To move forward for some time, we need to add a “Timer” block to our program and specify movement time in its properties.
  4. Connect all blocks in one flow and run “Start”!

Looking through Palette sections, you will find many other blocks that allow for processing information from robot sensors (distance, light, touch, even camera) and buttons, drawing on the robot screen and the floor, and controlling motors. To read about the block you are interested in, hover over Palette’s block or find a comprehensive description in the Help Center.

Maze solving example

As an additional descriptive example of TRIK Studio capabilities, let’s consider the classical wall follower algorithm (right-hand rule) for moving out the maze and its transparent implementation in TRIK Studio.

Wall follower algorithm in TRIK Studio 2D virtual environment

The main principle of the wall follower algorithm is simple — move and keep your right hand, always touching a wall. In general, this algorithm doesn’t work for all maze configurations, but that is one of the classical path-planning algorithms in educational robotics. The block scheme below describes robot behavior in the wall follower algorithm. Follow it to find the maze’s exit on the right side of the picture.

Block scheme of wall follower algorithm (left), example of its usage for maze (right, taken from Wikipedia)

The algorithm contains three primary actions — moving forward, turning left, and turning right. To implement them, we need to consider the same idea as in the basic example: to move forward — supply equal powers for motors for some time, to turn — supply opposite powers for the robot’s motors. TRIK Studio allows implementing subprograms — let’s use this feature to define every primary action.

Subprogram for Forward moving — between centers of maze cells
Subprogram for Left turn — use opposite power for both motors to rotate

Now we have all bricks to implement the wall follower algorithm from the depicted scheme. To determine a wall in front of us and on the right, we will use distance sensors attached to the robot in ports A1 and A2.

Set up infrared sensors to check walls in front and on the right

To check wall presence, we need to compare the sensors’ values with a threshold that describes the distance to the wall if we are in the center of the maze cell.

TRIK Studio provides all necessary control flow statements: condition, loops, switch. In our program, we will use Condition to find out the next robot actions. Below there is a compact implementation of the discussed algorithm block-scheme, exactly the same but using TRIK Studio blocks and created subprograms — as you can see, tight and clear.

Wall following algorithm implementation based on algorithm block-scheme and implemented subprograms. Note: to check wall we use sensor variable sensorA1, sensorA2 that correspond to infrared sensors in ports A1 and A2, and compare them with threshold.

Amazing configurable 2D virtual environment

After running the algorithm, we usually find ourselves in the Debug mode, a 2D virtual environment with simulation. Its’ main features allow using TRIK Studio to investigate a wide variety of essential robotics tasks: from the classical line following algorithm to SLAM-like algorithms in a complex environment.

Robot. The main object on the scene is the robot. To move the robot, drag-drop it on the scene, to rotate — use an arrow above the robot. You may also configure the start position and start angle of the robot using the same operations with the red cross that marks initial pose.

Set up robot initial position and angle on the scene

Sensor configuration. TRIK Studio supports a massive amount of sensors for every kit. You can find the full list in the drop-down menu of ports configuration. It worth noting that for TRIK kit camera sensor is supported besides classical sensors. For Lego Mindstorm EV3, you will find the support of advanced sensors like IR Seeker and LineLeader. Choose the configuration that you need for the task to be solved, and you will see new sensors on the scene. Configure their angle and position in the same manner as the robot position.

Set up sensors and their positions

Powerful 2D model. Take a look at the left panel of Debug mode — Tools panel — there you will find many tools to create your virtual environment.

  • Using Wall tool, you can create obstacles detected by range sensors — Infrared or Sonic sensors.
  • Tools Line, Curve, Rectangle, Ellipse, and Stylus are devoted to drawing on the scene. It is worth noticing that you can configure their width, color, and fulfill (if we talk about Ellipse and Rectangle). The robot can recognize those objects using a light sensor or color sensors.
  • One more incredible tool Image allows putting an image (PNG, SVG, etc.) on the scene. There are two supported modes — it can be visible for the robot if you set proper tick or be just a background. The first option allows you to debug algorithms on competition fields, usually provided by competition organizers in image formats for preparation. The second one will be suitable if you do a creative project — you can put drawings of a city map, house scheme, or any other background to implement your ideas.
Load any competition map on the scene that your need
  • Also, on the panel, you will find interactive elementsBall and Can, that can be moved by the robot. Those items are widely used in different competitions (like robotics football, tasks on collecting objects in some area, etc.), so that is one more feature to be used in your online classes and competition preparations.
Moving cans out of the circle as a part of classical robotics tasks

What about real robots?

The 2D virtual environment is not the only one way to run your program — TRIK Studio supports program generation for the real robot, including controllers from such popular robotics kits as TRIK, Lego Mindstorm NXT/EV3, and uploading them to the robot via different ways (Wi-Fi/USB/Bluetooth, depends on the kit). That gives you a unique opportunity to debug the algorithm first in the virtual world and then adapt it to the real one that significantly saves time in prototyping and allows creating programs even without the kit — for example, in out-of-class activities. For switching between virtual and real robot modes, use the button on the control panel. To choose your lovely robotics kit, go to Settings -> Robots.

It is the time for Python programming!

Python code generated for the wall following algorithm

Visual programming is a great tool when you immerse your students into the world of programming and robotics, but smooth and consistent transition through the educational process from basics to professional tools — no less important thing. TRIK Studio is a very comfortable way to move your students to textual programming — it supports code generation for Python and JavaScript (now only for TRIK kit). You don’t need to explain all the basics of program structure and syntax — just run code generation and analyze obtained constructions and code with your students. After you investigate that part, you can modify your textual program step by step, increasing its complexity, and you will notice that fear of the text notations and operators quickly disappears.

Not easy, but definetely unique things!

Create exercises with constraints. TRIK Studio supports constraints language to check the robot’s behavior when the algorithm is running. You can specify the steps that students’ algorithm should perform, and TRIK Studio will automatically check the solution. Moreover, you can create several virtual worlds and check students’ solutions to verify the algorithm’s adaptiveness (that is the core property of algorithms in robotics). For example, when designing an algorithm for moving out of the maze, it should work for different maze configuration. The same situation with the line following algorithm should be robust to different line curvatures.

Set up a server for automatic check of solutions. To automate this process, TRIK developers suggest using a docker-container with a checker inside that can be set up on the server to check students’ solutions automatically. This feature gives an excellent opportunity to organize online competitions in the same manner as programming competitions (CodeForces, TopCoder, etc.), checking solutions on several virtual world configuration.

The perfect solution for online competitions. All the abovementioned TRIK Studio capabilities open up online competitions and online qualifying rounds for massive in-person competitions. TRIK Studio is used as main tool on such widescale competitions as National Technological Initiative Olympiad, Innopolis Open, RoboFinist, etc. In 2020 — the year of total lockdown — there were organized more than 15 online competitions using TRIK Studio in Russia. WRO Hellas in Greece has announced an online robotics marathon based on TRIK Studio.

Where to find more information about TRIK Studio?

The common information about TRIK team products can be found on the site. Documentation is available in Help Center; for any questions, refer to Support Center — very benevolent for your inquiries and ideas. If you would like to look at TRIK Studio development or other open-source products of the TRIK team (for example, TRIK controller firmware), go to the GitHub account.

--

--