How to create a ros2 package that can be found by cli?
I've been trying to get caught up on the latest and greatest now that an LTS release of ROS2 has come out. I'm currently trying to create a package in a ros2 overlay workspace and I'm having trouble getting the launch file up and running.
I'm used to ROS1 where I had a launch directory in my package which contained XML .launch files and as long as the package was built I could run roslaunch package_name launch_file.launch
. I'm finding it to be not that straightforward in ROS2.
My package's structure is as follows where I have a containing folder called asar and in it:
.
├── CMakeLists.txt
├── image_capture
│ ├── CMakeLists.txt
│ ├── include
│ │ └── image_capture
│ ├── launch
│ │ └── publish_one_image.py
│ ├── package.xml
│ └── src
│ └── run_publish_images.cpp
└── vision_pipeline
├── CMakeLists.txt
└── package.xml
So there are two packages in this folder and I'm focusing on the image_capture
package right now.
I can call colcon build
at the top of my workspace and it builds everything fine. If I run the resulting executable manually it publishes correctly (just having it publish strings as a proof of concept). However when I run ros2 launch image_capture publish_one_image.py
I get an error back:
ssnover@styrka:~/dashing$ ros2 launch image_capture publish_one_image.py
Package 'image_capture' not found: "package 'image_capture' not found, searching: ['/home/ssnover/dashing/install/opencv_tests', '/home/ssnover/dashing/install/vision_opencv', '/home/ssnover/dashing/install/image_geometry', '/home/ssnover/dashing/install/examples_rclcpp_minimal_subscriber', '/home/ssnover/dashing/install/cv_bridge', '/opt/ros/dashing']"
Alright, so it's searching my workspace's install directories, and that list is generated by source /home/ssnover/dashing/install/local_setup.bash
which is in bashrc file. I can see when I check in the install directory that a directory has been made called asar
and there I can find the executable built by colcon under asar/lib/image_capture
as well as some other shell files under asar. So colcon appears to be treating my package similarly to the others, but ros2 CLI can't find it.
Am I missing a step? Is my package file structure incorrect?