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
  • Preparation
  • Setting up VSCode

Was this helpful?

Export as PDF
  1. INTEGRATIONS
  2. VSCode

Running a 2D model in TRIK Studio from VSCode

PreviousVSCodeNextUploading programs to several TRIK robots from VSCode

Last updated 4 years ago

Was this helpful?

This article discusses setting up and using the VSCode external programming environment to call programs in the TRIK Studio .

This will allow experienced TRIK Studio users to use all the features of professional text editors and their plugins: static analyzers, auto formatters, color themes.

It also describes how to automatically run the program on several fields, which can be useful for participants in competitions with automated verification systems.

Preparation

It is assumed that the user is writing a program in an external editor and would like to run this program on one or more fields. Fields can be presented both in .xml format (for more details, see the article ""), and in .qrs format.

  1. Download for Windows or for Linux and place it in the folder where TRIK Studio is installed.

  2. Place the fields on which you want to test the program in a separate folder. If the fields are in .xml format, create an empty default.qrs project in this folder.

The manual was tested on the January 2020 release (version 1.42). You can download VSCode from the .

Setting up VSCode

1. Create a folder where the source code file will be placed.

2. Open this folder in VSCode with File → Open Folder.

3. ChooseTerminal → Configure Tasks.

4. If there were no tasks before, then selectCreate tasks.json file from template → Others in the drop-down menu . The file tasks.jsonwill be opened. If tasks were created earlier, it will open right after point 3.

5. Delete everything from this file and paste this code, where <path to field dir>is the full path to the folder containing fields:

{
"version": "2.0.0",
	"tasks": [ {
		"label": "Run TRIK 2D model",
		"type": "shell",
		"command": "/home/admin/TRIKStudio/run_2d_model.sh" <path to fields dir> script.js",
		"windows": {
			"command": "D:\\TRIKStudio\\run_2d_model.cmd  <path to fields dir> script.js"
		},
		"group": "test",
		"presentation": {
			"reveal": "always",
			"panel": "new"
		}
	}]
}

6. Depending on your operating system, edit the filetasks.json:

  • For Linux, in the line corresponding to the "command" field, specify the path to the edited run_2d_model.shand specify your source code file as the third argument. This file should be located in the folder that we opened with VSCode. Example: "command": "/home/admin/TRIKStudio/run_2d_model.sh /home/admin/fields/ script.js"

  • For Windows, in the line corresponding to the

    "windows": { "command" field, specify the path to the edited run_2d_model.shand specify your source code file as the third argument. This file should be located in the folder that we opened with VSCode. Example: "command": "D:\TRIKStudio\run_2d_model.cmd D:\Users\Admin\fields script.js"

7. Save the filetasks.json.

8. Now select Run TRIK 2D modelin the dropdown menu Terminal → Run Task or press the corresponding keyboard shortcut (Ctrl+Shift+B) to run your code.

For the proposal to add this functionality, the TRIK project team thanks Alexander Zhuravlev, the participant of the NTI IRS Olympiad 2018-2020.

2D model
2D model tuning
run_2d_model.cmd
run_2d_model.sh
official website