I was correctly launching two launch files (let's say A and B) by means of a third launch file (C). Then I decided to impose that the nodes of launch files B should be started after the nodes of launch file A. After the modification the launch file C now looks like this:

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription,RegisterEventHandler
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.event_handlers import OnProcessStart

def generate_launch_description():
    ldesc = LaunchDescription()
    # Compute resource paths
    A_LaunchFilePath=A_BasePath + '/launch/A.py'
    B_LaunchFilePath=B_BasePath + '/launch/B.py'

    # Start launch file A

    # Start launch file B only after launch file A
    ldesc.add_action(RegisterEventHandler(OnProcessStart( target_action=A_Action, on_start=[B_Action])))

    return ldesc

Unfortunately, at least in my understanding, this code cannot work since the target_action must be an executable that can be flagged as started, while now is only a launch description containing the configured executables.

Do you know a solution to convey priority between launch descriptions instead the standard priority between nodes?

In case of only priority between nodes can be conveyed, is it possible to get the list of the actions contained in the included launch description in order to extract the desired executable to be used as target_action?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.