ouster-ros icon indicating copy to clipboard operation
ouster-ros copied to clipboard

Node parameters not parsed correctly when using python composite launch [Foxy]

Open Imaniac230 opened this issue 9 months ago • 0 comments

Is your feature request related to a problem? Please describe. This also is related to the unresolved part of https://github.com/ouster-lidar/ouster-ros/issues/212#issuecomment-1724075926.

While experimenting with my additions from https://github.com/ouster-lidar/ouster-ros/pull/323 on the ros2-foxy branch, I stumbled upon this issue from launch_ros https://github.com/ros2/launch_ros/issues/156 when launching the composite mode python launchfile (sensor.composite.launch.py). The behavior is exactly the same as described in the launch_ros issue:

  • composite nodes launch correctly only when the namespace, node name, and ros__parameters keys are completely removed from the config (os_sensor_cloud_image_params.yaml), otherwise the sensor composite node fails to launch.

To Reproduce

  1. Checkout ros2-foxy (tested from commit 1d7d5069) and configure required parameters in os_sensor_cloud_image_params.yaml
  2. Colcon build with ROS2 foxy and source the current workspace.
  3. Run ros2 launch ouster_ros sensor.composite.launch.py

Expected behavior All composable nodes launch correctly.

Actual behavior Sensor node fails with missing parameter error:

[component_container_mt-1] [ERROR] [1715262197.518517912] [ouster.os_sensor]: Must specify a sensor hostname

Describe the solution you'd like The issue was resolved by https://github.com/ros2/launch_ros/pull/259 in humble and onward (which added support for both types of syntax in .yaml files), but does not appear to be back-ported to foxy (the fixing commit is not present in the foxy branch history). I am not sure if the fix will get to foxy eventually, but I think a quick workaround could be quite straightforward with a pre-processing step that would be added into the launch file:

  • First possible solution:
    1. load all data from the params file,
    2. remove any occurences of the ros__parameters key and the keys one line above it (this should be quite consistent, since the ros__parameters key doesn't change),
    3. check for any repeating duplicates and keep only the first occurence,
    4. finally, pass these pre-processed parmeters to all composite nodes.
  • Second possible solution:
    1. load all data from the params file,
    2. for each node, extract only the raw parameters (after ros__parameters),
    3. pass these parameters to each node respetively,
  • Another solution would be to have a separate params file for the composite launch in foxy, but I think this would be more messy.

Targeted Platform (please complete the following information only if applicable, otherwise dot N/A):

  • ROS version/distro -> foxy
  • Operating System -> 5.15.0-105-generic #115~20.04.1-Ubuntu
  • Architecture -> x86_64

Imaniac230 avatar May 09 '24 14:05 Imaniac230