Debugging ROS2 solution in vscode

Hi everyone,
Has anyone tried to debug ROS2 code from vscode? What I mean is more of, debugging the entire solution or the entire navigation2 stack rather than just one single node or one single class.
Thank you!

What do you mean by this? What are you expecting to achieve? What you have in mind might not be what debugging is all about.

I have succeeded to debug a single node in ROS2, however I am wonderin if there is a way to add configurations to the launch file in vscode so multiple nodes can be debuged, and check the communication between them.

Hi @jindecasa,

I thinks that what you might be wanting to do is to first test an entire solution or application and then debug the errors… Let me explain:

Using software tests you can check if your code behaves as intended and catch any errors, bugs or defects. One particular type of tests, namely integration tests are meant to verify the correctness of an entire solution that contains for instance may nodes running simultaneously. Once you found the errors in your system you proceed to debug them. This is, you want to identify, isolate and fix errors, bugs or defects that have been discovered through testing, integration tests in this case or other means. When debugging you want to focus on a small part of your application to fix one particular error by examining only one node, for instance by setting breakpoints, and using various tools to isolate and resolve the problem.

Testing and debugging require different sets of tools. For testing you will use tools like pytest, gtest, cmake (and other) and in many cases it also involves writing special ROS nodes just meant to test your application. For debugging you will use other tools such as VSCode, Valgrind or GDB.

Both testing and debugging are very broad topics in themselves there is a lot to learn on that field.

I hope these pointers help you to find more information on what you want to achieve.

Cheers,

Roberto

Thank you @rzegers, I will try ome test first.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.