Ask Your Question
0

How to create a package that only contains launch files

asked 2020-12-14 17:48:29 -0500

SuchConfuse gravatar image

I want to create a package that only holds launch files for packages that I installed using apt-get. Let's say my package, called ros-package has the following folder structure:

.
├── CMakeLists.txt
├── launch
│   ├── a.launch
│   ├── all.launch
│   ├── b.launch
│   └── c.launch
└── package.xml

I want a.launch, b.launch, and c.launch each look something like this:

<launch>
    <node name="listener_node" pkg="hello_world" type="listener" output="screen"/>
</launch>

and all.launch just includes the other three and launches all of them. So I want to be able to "build" this package with catkin or colcon, source install/setup.bash, and run all with the following command:

roslaunch ros-package all.launch

Now I'm not sure how to setup the CMakeLists.txt and package.xml files to achieve this. Any help would be much appreciated.

With anything I've attempted the launch files don't get included in the install directory and are not found as a result.

Bonus question: I also have a config.yml file that I want to be copied into the install directory as well as it is passed on as an argument to one of the launch files.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2020-12-14 19:29:50 -0500

updated 2020-12-15 03:52:45 -0500

gvdhoorn gravatar image

The major thing is to install them (from here):

install(DIRECTORY launch/ 
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

and still call the catkin macro with your relevant info (might be just empty for you) https://github.com/SteveMacenski/slam....

You shouldn't have to do anything new to the package.xml if it is otherwise correctly setup.

edit flag offensive delete link more

Comments

Thanks, this is better than adding the files each individually.

SuchConfuse gravatar image SuchConfuse  ( 2020-12-16 17:16:46 -0500 )edit
1

answered 2020-12-14 18:29:35 -0500

SuchConfuse gravatar image

So it turns out I was having problems due to a typo in my launch file name. To answer the question, my package.xml only includes the default tags. My CMakeLists.txt has an additional entry for copying the launch files over to the install directory:

install(FILES
    launch/a.launch
    launch/b.launch
    launch/c.launch
    launch/all.launch
    DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)

The additional config.yml file can also be copied over to the install directory in the same manner.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-12-14 17:48:29 -0500

Seen: 240 times

Last updated: Dec 15 '20