ROS2 + VSCode + Docker set up

I’ve been playing around with ROS2 using VSCode + Docker and decided to share a template of my setup.

TL;DR

Features

Style

ROS2-approved formatters are included in the IDE.

  • c++ uncrustify; config from ament_uncrustify
  • python autopep8; vscode settings consistent with the style guide

Tasks

There are many pre-defined tasks, see .vscode/tasks.json for a complete listing. Feel free to adjust them to suit your needs.

Take a look at how I develop using tasks for an idea on how I use tasks in my development.

Debugging

This template sets up debugging for python files and gdb for cpp programs. See .vscode/launch.json for configuration details.

Continuous Integration

The template also comes with basic continuous integration set up. See .github/workflows/ros.yaml .

To remove a linter just delete its name from this line:

matrix: linter: [cppcheck, cpplint, uncrustify, lint_cmake, xmllint, flake8, pep257]

16 Likes

…psst @jacob … it would be great if my PRs against the ROS2 examples got merged so I don’t have to maintain a fork of it just so the linter CI checks pass.

2 Likes