ros2 launch or python3 foo.launch.py
I see several example launch files which implement a main, instead of just returning a launch description. Example from ros2/launch/ros repo: https://github.com/ros2/launch_ros/bl...
Is there a guideline which variant to prefer? Are there any advantages in using the ros2 launch variant?
#
edit: This seems to be a conceptual question. From what i can see, the deciding part that makes the nodes run is the following:
ls = launch.LaunchService(argv=argv)
ls.include_launch_description(ld)
return ls.run()
It should be easy to include other LaunchDescriptions
from other launch files like so:
client_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([share_dir, '/launch/client.launch.py']),
launch_arguments={}.items()
)
I dont see an advantage in letting the ros2 launch system take over the LaunchService
, when you lose quite some functionality by not defining your own main.
For example:
- printing the introspection of the launch file
- performing tasks after starting the nodes, like calling services
What am I missing that the creators of ros2 launch thought of?