ros2 / launch

Tools for launching multiple processes and for writing tests involving multiple processes.
Apache License 2.0
126 stars 144 forks source link

Expose the RegisterEventHandler action #658

Open esteve opened 2 years ago

esteve commented 2 years ago

Feature request

Feature description

Based on the discussion in https://github.com/ros2/launch_ros/issues/236#issuecomment-849975470, it'd be good to expose the RegisterEventHandler action so as to be able to support LifecycleNodes in launch_ros

esteve commented 2 years ago

@jacobperron @kenji-miyake for an example Python code like this:

        RegisterEventHandler(
            OnProcessStart(
                target_action=turtlesim_node,
                on_start=[
                    LogInfo(msg='Turtlesim started, spawning turtle'),
                    spawn_turtle
                ]
            )
        ),

I thought the XML could look like as follows:


<register_event_handler>
  <event_handler name="on_process_start">
    <target_action>turtle_sim_node<target_action/>
    <arg name="on_start">
        <action>log_info</action>
        <action>spawn_turtle</action>
    </arg>
  </event_handler>
</register_event_handler>

But I'd appreciate any feedback. Thanks.