I’ve been playing around with ROS2 using VSCode + Docker and decided to share a template of my setup.
TL;DR
- Get the template: https://github.com/athackst/vscode_ros2_workspace
- Read more about how I use it: https://www.allisonthackston.com/articles/vscode_docker_ros2.html
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]