Text Editors for Robotics

Why matter about a text editor?

Vim is fast and highly customizable

Software is a huge deal for robotics. Though a robot consists of electronics and mechanics, the software is usually where to robot shines as an intelligent system. For this reason, being comfortable with a good text editor can save a lot of time.

So much choice

I have tested many different text editors to find the one and only one editor that I wanted to use for all my work. Of course, I considered the default GNOME editor gedit and the KDE counterpart Kate. Then I also looked at the terminal based editors like nano, Vim and Emacs and the more shiny ones such as Sublime, Visual Studio Code and Atom from Github. There are also some more specialized ones such as PyCharm which focuses on Python programmers. So what is my final impression of those?

In general, I think that all of these editors have their pros and cons. There is no perfect editor, especially when there is a large variety of tasks that the editors are used for such as large programming sessions and quick edits on a small configuration file.

The terminal-based text editors are always good to have on the system, especially when you run into a situation where you don’t have a Desktop Environment. In robotics, this situation happens quite regularly as robots don’t need fancy visuals on their systems as this would only cost processing power with no big benefits. Remote login through SSH is a fairly common process and having at least nano installed will allow editing files whenever you need to. On your local system, these editors are also quite nice when you need administrator rights to edit a file so you open the terminal anyways.

Nano is often already preinstalled

The more simple editors such as gedit or Kate are nice for making quick changes. They are usually preinstalled as well, depending on the Desktop Environment. Similar editors are used for different distributions. They usually provide basic functionality such as line numbers, syntax highlighting and opening several files in different tabs. They usually come as they are with little possibilities to add extensions or plug-ins. This makes them a useful tool for quick changes but less interesting for long programming sessions of debugging the code.

The text editors that I consider as more elite and extensible are Sublime, Visual Studio Code and Atom. To me, they look and behave like overpowered versions of gedit and similar. Their main features are that they allow installing extensions which makes them more powerful than simple editors. They also allow to build and compile the code from within the editor and they also allow for easier debugging, especially Visual Studio Code which is very close to a full IDE. It provides extensions for ROS (the Robot Operating System), Python, C/C++ and much more.

What I like most about Visual Studio Code is its easy interface to add extensions for all kinds of purposes from Markdown features, Jupyter Notebook interpretations to building your ROS packages. There are many packages out there from various developers. What I don’t like is the fact that it is based on electron which creates more overhead to make the editor work. Atom is similar in this approach, though I think it has less community support as there are fewer packages available, but still a lot.

Sublime is a commercial text editor with very nice default settings and as it is running as a standard compiled program, and not based on web technology, it is much faster while being lighter on the systems resources.

Why limit yourself to only one editor?

Each type of text editor has its pros and cons and each program is made for its own set of purposes. Terminal based editors are meant to run in a terminal emulator which allows for easy use through remote access. The lightweight and simple text editors allow for easy editing files but they do not provide the same functionality as their overpowered competitors. The most advanced text editors provide many bonus features, but they tend to be resource hungry.

In this concept, I thought that it is not the best choice to use only one single text editor. I decided to use Vim for everything I do in the terminal, be it to change some config files on the local system or files remotely through SSH. I use gedit if I only want to have a quick peek at some config files in my working directories or to take some quick notes and when I know I will work with a lot of code in many different files and I need to compile and run the code, I use Visual Studio Code. For the last category, I am still thinking of making the switch to Sublime as it is less heavy on my system, especially when I also run a virtual machine or similar. On some occasions, I use Vim for some special tasks that can easily be done with its build-in features which can save a lot of time and I would recommend everyone to have a closer look at Vim or Neovim as these are very powerful programs, they just have a steep learning curve, to begin with.

Conclusion

In the end, there is no “best” editor for everyone and in my case not even a “best” editor for all my tasks. The important thing is that I get my job done and I choose the tools that I find the most suitable for that job. More important than the choice of the editor is that you get to know your editor(s) of choice and that you get to learn some of the nice features that allow you to use the full potential of the programs that you use. You might have different needs and therefore you use different tools. In robotics, the tasks are quite diverse which is why I prefer using different text editors in parallel.

I am a master student specializing in robotics. I am a Linux enthusiast and I love helping people with my knowledge. I also have a website: davesroboshack.com