ros2 / launch

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

Add more convenient Include action #634

Open sloretz opened 5 years ago

sloretz commented 5 years ago

Feature request

This is a request to make it simpler to include a launch file from a ROS package. Currently it looks like this:

IncludeLaunchDescription(
    AnyLaunchDescriptionSource(
          [FindPackage('my_package'), '/share/my_package/launch/my_launch.py'])),

But it could look like this:

from launch_ros.actions import IncludeLaunchFile
# ...
IncludeLaunchFile(package='my_package, file='my_launch.py')

Implementation considerations

This would remove the need to know the full path to the launch file. FindPackage might return a path that's shared with many other packages in a merged workspace (like /opt/ros/dashing), so it should limit the search to share/my_package.

IanTheEngineer commented 5 years ago

As an alternative to searching for a file directly, it may make sense to detect the root of the package's install or src directory, and reach into the relative path from there:

from launch_ros.actions import IncludeLaunchFile
# ...
IncludeLaunchFile(pkg='my_package', file_path='launch/my_launch.py')

similar to rospkg:

import rospkg

r = rospkg.RosPack()
launch_path = ''.join(r.get_path('my_package'), 'launch/my_launch.launch')

or the ROS1 commandline / launchfile syntax with the rospack comand

$ `rospack find`/launch/my_launch.launch
adityapande-1995 commented 2 years ago

We should move this to ros2/launch since the IncludeLaunchDescription action lives there.