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

Revision history [back]

click to hide/show revision 1
initial version

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:

  • https://github.com/ament/ament_index/issues/33
  • https://github.com/colcon/colcon-ros/pull/74
  • https://github.com/colcon/colcon-ros/pull/79
  • https://github.com/colcon/colcon-ros/pull/82