Accelerate Robot Coding With the New VSCode Support

Robot programming can be so much easier with the right tools. Our new support for Visual Studio Code will accelerate your coding.

For years, I insisted on doing all my programming in a normal text editor. I don’t know why. Perhaps just out of the force of habit. I would type every line, every word, every semicolon of code individually.

There was no way for me to tell if I had made a mistake until I compiled the code, downloaded it to the robot, and pressed “Go”… and by then it was often too late. Lots of debugging was required.

Then one day, I discovered that text editors exist which are devoted to programming. They included features like syntax highlighting, code completion, and an integrated command line. Suddenly, my programming skills accelerated.

Our latest RoboDK update includes support for Visual Studio Code (VSCode) for the first time. As the most popular development environment of 2019, this new integration has the potential to accelerate your robot programming skills.

What Is Visual Studio Code?

VSCode is a cross-platform, open-source code editor made by Microsoft. It has versions for Windows, Mac, and Linux. In a survey of Stack Overflow users this year, VSCode was ranked the top IDE across all types of developers.

For many years, Microsoft was vehemently opposed to open-source software. But, more recently they have changed their tune and released some of their programming tools as open-source. VSCode was released under the open-source MIT license in 2015.

VSCode is part of the Visual Studio group of software tools which includes the following:

  • Visual Studio — The full-featured IDE designed for developing Windows and .NET applications, heavily based around Graphical User Interfaces (GUIs).
  • Visual Studio Express — Free, simplified versions targeted at specific applications (e.g. web development, C# coding).
  • Visual Studio Community — A free, simplified version of full Visual Studio.
  • Visual Studio Code — A free, cross-platform code editor which can be extended with plugins.

Visual Studio Code is a bit different from other versions of Visual Studio. It is much simpler and doesn’t focus everything around GUI development.

Visual Studio vs VSCode

If you’re familiar with Visual Studio already (but not VSCode) you might be wondering what the difference is between the two.

Here are 5 differences between the two programs:

  1. VSCode is more of a lightweight code editor than the all-encompassing, “heavy” IDE that Visual Studio is.
  2. GUI development is not a core feature in VSCode, whereas GUI development is a core part of Visual Studio.
  3. Visual Studio is more project-oriented whilst VSCode is more file-oriented.
  4. Visual Studio is mostly targeted at .NET developers but VSCode can be used for any type of coding.
  5. VSCode works on less powerful computers which would struggle to run the full Visual Studio.

VSCode Extensions and Plugins

One of the key advantages of VSCode is that its features can be extended with plugins from the Visual Studio Extensions Marketplace.

Extensions exist for many different uses, including a ROS (the Robot Operating System) extension, various Python extensions, and a wealth of other extensions for specific programming tasks.

We now have our own RoboDK extension, which I’ll introduce below.

What the New RoboDK Support Can Do

We all have our own favorite editor for coding. RoboDK is very flexible in this regard as it has the capability to use any text editor.

RoboDK also integrates with the following editors:

  • SciTE — This is the default text editor for RoboDK for editing robot programs. It is a cross-platform text editor which was originally developed to demonstrate the capabilities of the Scintilla code editing components. It has grown into a useful text editor in its own right.
  • Python IDLE — This is the development environment which is used by default when you edit Python scripts within RoboDK.
  • VSCode — The latest version of RoboDK comes packaged with the VSCode editor, allowing you to use it “out of the box.”

Until now, many users just used Windows Notepad or the slightly more featured Notepad++. This was okay, though slightly cumbersome. VSCode provides a much richer set of features.

How to Use VSCode

Assuming that you have set VSCode as your chosen editor in the Options window (go to Tools>Options>Program), the editor will be called when you perform any of the following tasks in RoboDK:

  • Select “Generate Robot Program” — The generated program will be opened in VSCode. If you are using the syntax highlighting extension (see below) the robot code will also be colorized.
  • Edit Python Script — The script will open in VSCode, which already includes syntax highlighting for Python.
  • Add/Edit Post-Processor — The post-processor code will open in VSCode, with syntax highlighting if using the extension.

Syntax highlighting

As part of the new support, we have also released a VSCode extension for syntax highlighting. This feature changes the color of the different parts of a programming language and makes it much easier to see what each part of the programming is doing. This reduces the chance of coding errors upfront before you even get to the debugging stage.

Syntax highlighting can be tricky when you are using different robot brands because each manufacturer uses its own programming language.

The RoboDK extension currently includes support for the following robot languages:

  • ABB RAPID (MOD/PRG files)
  • Comau (PDL)
  • Fanuc (LS files)
  • Kawasaki (PRG)
  • KUKA KRC (SRC files)
  • Yaskawa/Motoman (JBI/Inform)
  • Stäubli (VAL3/XML)
  • Universal Robots (script)

We will continue to update the extension to increase support for more robot controllers and filetypes.

Keeping Up The Spirit of Open Source

Do you need a robot language which our extension doesn’t support yet?

We are also releasing the extension as open source. If you like, feel free to checkout the code library and add the support yourself, to benefit both your programming and other robot users.

What to Do Now

If you haven’t got the latest version of RoboDK, download it via the download page. You can try out the VSCode support immediately and get started with accelerating your robot programming!

What do you think of VSCode? Tell us in the comments below or join the discussion on LinkedIn, Twitter, Facebook, Instagram or in the RoboDK Forum.

Alex Owen-Hill

About Alex Owen-Hill

Alex Owen-Hill is a freelance writer and public speaker who blogs about a large range of topics, including science, presentation skills at, storytelling and (of course) robotics. He completed a PhD in Telerobotics from Universidad Politecnica de Madrid as part of the PURESAFE project, in collaboration with CERN. As a recovering academic, he maintains a firm foot in the robotics world by blogging about industrial robotics.

View all posts by Alex Owen-Hill

Leave a Reply

Your email address will not be published. Required fields are marked *