ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

ament_python: Package doesn't explicitly install a marker in the package index

asked 2020-12-09 07:50:52 -0600

Felix Widmaier gravatar image

I am currently trying to implement a pure-Python ROS 2 package with ament_python.

When building, I get the following warning:

WARNING:colcon.colcon_ros.task.ament_python.build:Package 'foobar' doesn't explicitly install a marker in the package index (colcon-ros currently does it implicitly but that fallback will be removed in the future)

Unfortunately, I wasn't able to find any information about this. What is this "marker" about and how do I install it correctly?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-12-09 10:53:17 -0600

sloretz gravatar image

The "package index" is part of the ament resource index. It's how ROS 2 tools figure out what packages are installed. Read about the design of it is here.

Colcon currently creates this file automatically for ament_python packages, but it won't in the future. Packages will need to install a marker file themselves. This is just a blank file in share/ament_index/resource_index/packages/foobar where foobar is the name of your package.

The usual way to install this is to copy an empty file using the data_files argument. (actual example in ros2topic).

Your package layout might look like:

mypythonpkg/
├── mypythonpkg
│   └── __init__.py
├── package.xml
├── resource
│   └── mypythonpkg
└── setup.py

And your setup.py might have

package_name = 'mypythonpkg'

setup(
    # ...
    data_files=[
        ('share/' + package_name, ['package.xml']),
        ('share/ament_index/resource_index/packages',
            ['resource/' + package_name]),
    ],
    # ...
)

If you're interested in why Colcon's behavior is changing, there's more info here:

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-12-09 07:50:52 -0600

Seen: 5,447 times

Last updated: Dec 09 '20