Open gsanya opened 1 month ago
I don't fully understand the problem yet, but managed to solve it with a little hacking....
The problematic launch file is this one: https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_driver/launch/spot_driver.launch.py
It has the generate_launch_description
function which returns the launch description. But the executable nodes are made in the launch_setup
function which is added as an opaque function to the LaunchDescriptor.
When VSCode starts the Debuggers it processes the launch files with the following script: https://github.com/ms-iot/vscode-ros/blob/master/assets/scripts/ros2_launch_dumper.py
Which uses a different method to get all nodes than the original launch package in the ros2 og repo and this difference is causes the problem.
It iterates over the launch descriptor and if any entity adds a new entity its added to the list, so it will be iterated over. The problem is in line 112 where the visit function is called. If it returns with some entity it is added to the list, but if it returns with none, nothing is added.
In this particular launch file the opaque function adds new entities to the original LanchDescriptor and the visit function returns None. This is problematic, because the original LaunchDescriptor is not checked so the entities are not added to the list, and thus the executable nodes are never started.
I rewrote the launch_setup
function so it returns the entity list, and thus the visit function returns with not None. The original ros2 launch processor can deal with this so I think some checks should be added to see if something is added to the LaunchDescriptors entity list later on in the launch process.
(Please add appropriate labels)
\<Version of the plugin> v0.9.2
\<Copy the Version information from the
Help | About
menu> Version: 1.92.0 Commit: b1c0a14de1414fcdaa400695b4db1c0799bc3124 Date: 2024-07-31T23:26:45.634Z Electron: 30.1.2 ElectronBuildId: 9870757 Chromium: 124.0.6367.243 Node.js: 20.14.0 V8: 12.4.254.20-electron.0 OS: Linux x64 6.5.0-44-generic snapwhat is the bug
\<current behavior> The following launch.json file doesn't start the debugging:
It produces the following error popup:
While the following 2 commands start the launch file correctly (so it's not a problem with the launch script):
Repro steps
\<how to reproduce the bug. Please attach sample files or github repo if appropriate.>
expected behavior
\<what you would expect to happen> The debugger starts the nodes are debugable.
additional context
\<any additional information would be helpful for a better understanding> This shouldn't cause a problem, but I try to make the debugger work inside a dev_container.