From 28351778cbab458115eab2c98060f79362d6c2d5 Mon Sep 17 00:00:00 2001 From: andanders <49952149+andanders@users.noreply.github.com> Date: Mon, 28 Apr 2025 13:32:38 +0200 Subject: [PATCH] Update Creating-Launch-Files.rst how to get launch file included in the build Signed-off-by: andanders <49952149+andanders@users.noreply.github.com> --- .../Intermediate/Launch/Creating-Launch-Files.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/Tutorials/Intermediate/Launch/Creating-Launch-Files.rst b/source/Tutorials/Intermediate/Launch/Creating-Launch-Files.rst index e49cd9cbd5f..8417c1694e2 100644 --- a/source/Tutorials/Intermediate/Launch/Creating-Launch-Files.rst +++ b/source/Tutorials/Intermediate/Launch/Creating-Launch-Files.rst @@ -156,6 +156,17 @@ In other words, ``turtlesim2`` will mimic ``turtlesim1``'s movements. 3 ros2 launch ^^^^^^^^^^^^^ +To include your launch file in the build, you must instruct `setup.py` to copy it. When you run `colcon build` the .xml will be copied to the `share` dir. +Edit `setup.py` and add your launch file to the `data_files` variable: + +.. code-block:: python + + # excerpt from setup.py + data_files=[ + # ... + ('share/' + package_name, ['package.xml', 'launch/turtlesim_mimic_launch.xml']), # add your launch file here + # ... ] + To run the launch file created above, enter into the directory you created earlier and run the following command: