ros2/launch_ros

SetParameter does not propagate into event handler callback

tonynajjar opened this issue · 1 comments

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22
  • Installation type:
    • binaries
  • Version or commit hash:
    • Humble
  • DDS implementation:
    • rmw_cyclonedds_cpp

Steps to reproduce issue

from launch import LaunchDescription
from launch.actions import GroupAction, RegisterEventHandler
from launch.event_handlers import OnProcessStart
from launch_ros.actions import LoadComposableNodes, Node, SetParameter
from launch_ros.descriptions import ComposableNode


def generate_launch_description():  # noqa: D103
    container = Node(
        name="container",
        package="rclcpp_components",
        executable="component_container",
        output="screen",
        respawn=True,
    )
    load_composable_nodes = LoadComposableNodes(
        target_container="container",
        composable_node_descriptions=[
            ComposableNode(
                package="composition", plugin="composition::Talker", name="talker"
            ),
        ],
    )
    event = RegisterEventHandler(
        OnProcessStart(
            target_action=container,
            on_start=[load_composable_nodes],
        )
    )

    bringup_cmd_group = GroupAction(
        actions=[
            SetParameter("use_sim_time", True),
            container,
            # load_composable_nodes, # with this use_sim_time of the talker node is True
            event, # with this use_sim_time  of the talker node  is False

        ]
    )

    ld = LaunchDescription()
    ld.add_action(bringup_cmd_group)
    return ld

Expected behavior

ros2 param get /talker use_sim_time -> should yield True

Actual behavior

ros2 param get /talker use_sim_time -> yields False

Additional information

In case you are wondering why I need to do it like this, it's to workaround this issue


I notice the same for SetEnvironmentVariable, it will also not propagate into the event handler callback