I think ros2 run
uses the ament index to find packages, and it looks like the package temoto_parser
isn't installing a marker file.
Create a folder called resource/
(this folder name doesn't really matter, it's just what's been used so far) in the same directory as your setup.py
file. Next, create an empty file with the same name as your package in that folder: resource/temoto_parser
. In your setup.py
use the data_files
keyword argument to install the marker file temoto_parser
to share/ament_index/resource_index/packages
.
See the ros2/examples repo for python packages that do this. Here's the relevant part of the setup.py, and here's a marker file in a folder called resource
.
Here's a page with a little more info about the ament_index, though it's targeted at packages using CMake.
Originally posted by sloretz with karma: 3061 on 2019-09-06
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by SouLeo on 2019-09-06:
Thank you so much! This solved my problem!
Comment by DanRose on 2019-09-07:
I believe this is due to a bug in colcon core. Package discovery currently uses either setup.py or setup.cfg. I’m working on a fix in https://github.com/colcon/colcon-core/pull/215
Comment by Dirk Thomas on 2019-09-07:
This behavior is not a bug. Earlier colcon-ros
did this automatically for the user but that "magic" has recently been removed (https://github.com/colcon/colcon-ros/pull/74) since it makes it difficult for users to spot that while it works when building from source it would fall when packaging the package into e.g a Debian package.
Comment by DanRose on 2019-09-07:
I think there is a bug here, though I may have misattributed it. Here's which files change when you remove the setup.cfg and colcon build --symlink-install
. Note the path.*
hooks so that, without setup.cfg, the directory containing srl_test
gets injected into PATH
:
-./build/temoto_parser/setup.cfg
-./install/temoto_parser/lib/temoto_parser
-./install/temoto_parser/lib/temoto_parser/srl_test
-./src/ROS2_AllenNLP_Parser/parser/setup.cfg
+./install/temoto_parser/bin
+./install/temoto_parser/bin/srl_test
+./install/temoto_parser/share/temoto_parser/hook/path.dsv
+./install/temoto_parser/share/temoto_parser/hook/path.ps1
+./install/temoto_parser/share/temoto_parser/hook/path.py
+./install/temoto_parser/share/temoto_parser/hook/path.sh