[Python] How to debug Python and C++ ROS2 nodes simultaneously VS code

Discussão em 'Python' iniciado por Stack, Maio 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am using Ubuntu 22.0.4. My ros2_ws has three packages: gui, robot_ws, robot_ui_msg_interfaces. The gui is a python package i.e. basically UI developed with PyQT5 and ROS2. The robot_ws is a C++ package i.e. backend of UI written in C++ and ROS2, the robot_ws listens to UI buttons via ROS2 i.e if any button is clicked on UI the robot_ws node called robotMainStart responds via performing some action. Further, robot_ui_msg_interfaces is pure interface between gui and robot_ws, it consists of service/client and pub/sub messages. I have created a launch file inside gui/launch folder called gui_launch.py. This launch file launches both python package node called main_node and robot_ws c++ node called robotMainStart and the communication will take place between these python and c++ nodes via pub/sub & service/Client . I am using VS code. I put break points in both my C++ script robotMainStart.cpp i.e. robotMainStart node and python script mainPage.py i.e. main_node node.

    Firstly, I want to know: is there a way or debugger which can debug both Python and C++ nodes simultaneously? What I mean is: if I put a break point for a move button on gui python node and another break point inside C++ script i.e. backed of UI, where the action reponse of this move button takes place in c++. When I run the debugger, Will running the debugger first breaks at python gui move button function and then we hit 'step into' it breaks at std::cout action response for the move function in robotMainStart C++ node?

    Is there a way we can do this? or we can't run both ROS2 python and C++ nodes for debugging simultaneously and we need to run them separately?

    Continue reading...

Compartilhe esta Página