Skip to content

rickstaa/ros_debug_vscode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ros_debug_vscode

⚠️ UPDATE: As of 31 aug 2019 the debug functionalities described below are also included in the official ros vscode extension. A guide on how to use this extension and its ROS debug functionality can be found here.

Goal

The goal for this project is to demonstrate the debugging ROS node implementation using VSCode, but of course, the underlying compiler is g++ and debugger is C++ debugger, the VSCode is IDE invoking these underlying tools. My blog post contains a bit more info.

Project Content

This project contains an example project structure followed by the catkin workspace creation and it contains implementation for talker and listener.

How to run

  1. remove the "devel" and "build" folders, rebuild using "catkin_make -DCMAKE_BUILD_TYPE=Debug"
  2. run "talker" as rosnode
  3. find out the process id of the talker process
  4. modify the ".vscode/launch.json", by replacing "25159" with the id obtained from previous step
  5. set some break points in the "src/talker.cpp", start debugger from vscode and be happy

Troubleshooting

Catkin build -DCMAKE_BUILD_TYPE equivalent command

When you use catkin build instead of catkin make you can specify the build type by using the catkin config -DCMAKE_BUILD_TYPE=Debug command.

How to use in a singularity image

When you want to debug a ROS package that was built inside a singularity container, you have to make sure that the working directory while executing the build command and the working directory you opened inside vscode to debug are equal. This is because, in a singularity image, folders on the home and root folder can be accessed both by their absolute and relative paths. This can lead to path inconsistencies between the build package and the package scripts you are debugging.

About

ROS debug vscode example repository

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Makefile 55.5%
  • CMake 20.6%
  • Python 11.5%
  • C++ 6.3%
  • C 3.9%
  • Shell 2.1%
  • Common Lisp 0.1%