Sequentially starting launch files using ROS 2 Python when a specific log message is detected

In the past, I’ve had success making a simple python node that exits when some event happens (a lifecycle change, a topic is published, a parameter change, looking for some text in the roslogs as they’re getting written, whatever). Then you can use the OnProcessExit event handler to trigger your subsequent stages. This way you don’t have to use ExecuteProcess - you can have Node or IncludeLaunchDescription actions directly.

If you do use ExecuteProcess, try setting shell=False - things seem to hang around in the background when you use shell=True

1 Like