Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] ROS2 launch processor was unable ro produce a node list. #1296

Open
2 of 4 tasks
gsanya opened this issue Aug 7, 2024 · 1 comment
Open
2 of 4 tasks

[bug] ROS2 launch processor was unable ro produce a node list. #1296

gsanya opened this issue Aug 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@gsanya
Copy link

gsanya commented Aug 7, 2024

(Please add appropriate labels)

  • Windows: (Version)
  • Linux: Ubuntu 22.04 (Dist/Version)
  • ROS 1: Dist
  • ROS 2: Humble

<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 snap

what is the bug

<current behavior>
The following launch.json file doesn't start the debugging:

{
    "configurations": [
    {
        "name": "ROS: Launch",
        "type": "ros",
        "request": "launch",
        "target": "/home/appuser/spot_ros2/src/spot_ros2/spot_driver/launch/rviz.launch.py",
        "arguments": ["config_file:=/home/appuser/spot_ros2/src/spot_ros2/spot_driver/config/our_spotty.yaml",
                    "spot_name:=spotty publish_point_clouds:=True",
                    "launch_rviz:=True",
                    "uncompress_images:=False",
                    "publish_compressed_images:=True"]
    }    
    ]
}

It produces the following error popup:
image

While the following 2 commands start the launch file correctly (so it's not a problem with the launch script):

source install/setup.bash
ros2 launch spot_driver spot_driver.launch.py config_file:=/home/appuser/spot_ros2/src/spot_ros2/spot_driver/config/our_spotty.yaml spot_name:=spotty publish_point_clouds:=True launch_rviz:=True uncompress_images:=False publish_compressed_images:=True

Repro steps

<how to reproduce the bug. Please attach sample files or github repo if appropriate.>

  1. Create the launch file above
  2. ctrl+shift+p: ROS: Start
  3. On the run and debug pane click the green arrow beside ROS: Launch

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.

@gsanya gsanya added the bug Something isn't working label Aug 7, 2024
@gsanya
Copy link
Author

gsanya commented Aug 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant