launch icon indicating copy to clipboard operation
launch copied to clipboard

Add more convenient Include action

Open sloretz opened this issue 6 years ago • 2 comments

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.

sloretz avatar Jul 30 '19 18:07 sloretz

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

IanTheEngineer avatar Jul 30 '19 19:07 IanTheEngineer

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

adityapande-1995 avatar Jul 28 '22 23:07 adityapande-1995