Exploration of VS Code extensions for a ROS Developer
In the developers' community, there will always be an ongoing debate about the best IDE (Integrated Development Environment) out there, be it IntelliJ, Xcode, Eclipse, Atom, Sublime Text, or Visual Studios. But this blog isn’t about choosing the best IDE. I personally love to code in VS Code as a Robotics (ROS) developer. Being a ROS developer is way different than let’s say being a Web developer, especially in terms of the infrastructure available to make development easier.
When I first started coding, my VS Code setup was very minimal and the only extensions I used were specific to writing C++/Python code.
Until now, I had been utilizing the command-line interface (CLI) to execute various functionalities within ROS.
This is my experience of exploring the extensions available for ROS development and comprehension of the missing functionalities.
While doing research for this blog, the first thing I did was simply type ROS in the search bar for extensions in VS Code.
The very first Visual Studio Code extension for ROS was by Microsoft which provides ROS developers with a long list of features and functionalities like information about the ROS status and active topics, creating a ROS environment with sourced terminal, running ROS executables and launch files, and much more. This extension is readily available in the VS Code extensions marketplace and can be installed with a single click.
Some cool functionalities that you can enjoy after installing this extension are:
- URDF Previewer
Developing a robot’s URDF in ROS is tedious as you need to write the URDF file as well as a launch file for the robot state publisher, joint state publisher, and RViz to then visualize the robot model. Every time you make changes to the URDF code, you need to execute the launch file and review it in RViz. This process is time-consuming, repetitive and adds frustration for the developer. ROS VS Code extension is there to make this process easier by providing a URDF previewer. URDF previewer functionality enables the visualization of the robot model alongside the .urdf file as shown below. You can make the edits to the URDF file and automatically see the live update of the robot model making development much faster.
- Multiple ROS Nodes Execution
Traditionally, ROS developers have to open a new terminal tab to run multiple ROS nodes separately or even for running multiple ROS launch files. This also requires you to know the package name, executable names, etc. I have generally ended up trying to do tab completion to find the correct name of the node. The ROS VS Code extension makes this so much easier by automatically detecting and running the selected ROS packages via the executables or launch files. It will also take care of sourcing terminals with the correct path for successful execution.
- Build Configurations
Say goodbye to the days when you needed to type the
colcon build command for building ROS workspace along with numerous arguments over and over again. ROS VS Code plugin provides a smoother process to build ROS workspaces. By specifying catkin/colcon commands and arguments inside the
.vscode/tasks.json file, you can simply run the
colcon: build command to build the workspace.
- Debug Configurations
Finding bugs in the codebase is always much more painful than actually writing a new node. But with ROS VS Code extension, setting up a working debugging session is pretty straightforward. All you need to do is add a launch configuration
(launch.json) to the
.vscode folder in the ROS workspace then you can set a breakpoint for the node you want to debug. This extension also works with attaching the debugger to multiple nodes as
launch.json can take an array of nodes.
- System Status
The ROS Status page functionality provides information about the ROS Core/ROS 2 Deamon, active nodes, topics, and services.
The ROS VS Code extension provides IntelliSense syntax highlighting and code completion for URDF/Xacro files, .msg files, .srv files, and almost all other ROS-related file types.
Another plugin that I found useful was CMake by twxs:
- Syntax Formatting
You can use this CMake extension in VS Code to get syntax highlighting and code completion for your
Although the current extensions for VS Code for Robotics provide tons of features for a faster, better development process, as an experienced and active ROS developer, I find some essential features still missing.
- ROS Bag interface
Even for the most basic use case of let’s say tuning Slam Toolbox, I would look at the rosbag and play it several times to tune the algorithm to my satisfaction. ROS Bags are an essential block for any robotics system. There is only one plugin currently available for ROS 1 that can list the timestamps and the topics of the messages stored in the rosbag file. And the output of
rosbag info filename. For starters, I would like to at least have the ability to play rosbag using a click-on Play Button from the VS Code menu bar itself.
- Parameters in System Status
The change in the robot’s environment might create the need to update a few ROS parameters or maybe the customer wants the robots to operate at maximum speed compared to another customer. Maintaining and managing ROS Parameters can quickly become very painful. Although the ROS system status functionality can display active nodes, topics, and services, it does not show any information on active parameters in the computation graph.
- Joint Visualisation in URDF Previewer
While setting up the robot’s URDF, I generally try to test out the movement of each joint specifically the direction and axes of rotation. The current URDF previewer should also support Joint Visualisation for ease of debugging and verification of the robot model.
- Interactive ROS Graph Visualisation
I would love to have an extension that visualizes the ROS graph, displaying nodes, topics like tf, and connections in an interactive graph view.
- ROS Documentation Integration
Another cool to have extension could be a ROS Documentation Integrator. This extension can integrate ROS documentation directly into VS Code. It can allow you to quickly search and access ROS API documentation, tutorials, and examples without leaving the editor.
- Unit & Integration Tests
This is the one I most desperately need. An extension that can enable running and managing unit tests/integration tests (both Google tests and rostest) directly from VS Code. It can provide an intuitive interface for executing tests, viewing test results, and generating test reports.
I am really grateful to have installed the plugins available for ROS. If I have to put an estimate on the percentage of the time these plugins have saved, I would say it is about a 40% reduction in the overall development time especially for writing and executing ROS nodes. The ROS plugins aren’t perfectly developed yet as witnessed especially due to the unique challenges of visualization and data formats of ROS. As the robotics community is continuously growing, I have high hopes that the development environments would also improve over time. As of today, I highly recommend using the existing plugins to save time, especially for startups who struggle with maintaining one development process across the organization.
If you liked the article, please buy me a ☕️ coffee