Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Launch-system.rst #4068

Merged
merged 7 commits into from
Dec 20, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions source/Tutorials/Intermediate/Launch/Launch-system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,13 @@ Make sure to create a ``launch`` directory at the top-level of the package you c
setup.py
test/

In order for colcon to find the launch files, we need to inform Python's setup tools of our launch files using the ``data_files`` parameter of ``setup``.

Inside our ``setup.py`` file:
To enable colcon to identify the launch files, it is necessary to inform Python's setup tools of their location using the ``data_files`` parameter of ``setup``.
To achieve this, open the ``setup.py`` file, add the requisite import statements at the beginning of the file, and update the ``data_files`` parameter as follows:

.. code-block:: python

import os
from glob import glob
import os # ADD
from glob import glob # ADD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I'm not a fan of this either. I agree that it is somewhat hard to understand what to change, but I think this is pretty ugly.

Instead, I'd like to think of another way to do this. Elsewhere where we have this pattern (like http://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Using-Parameters-In-A-Class-Python.html#change-via-a-launch-file), we say something like:

"Add the import statements to the top of the file, and the other new statement to the data_files parameter to include all launch files.".

So I think we should do the same here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking better, but we should still remove the # ADD lines on these lines. Once that is done, I'm happy with this.

from setuptools import setup

package_name = 'py_launch_example'
Expand Down
Loading