ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
As per request of the questioin poster I'll highlight the answer in the comments that worked for him here:
In CMakeLists.txt you need to put an install()
command which basically tells colcon build
to put either a copy or a link to a certain folder in the share directory. The share directory is the default place where ros2 launch
will look for things.
So if you add
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME})
To your CMakeLists.txt and then do a colcon build
your share directory, so for instance ros2_ws/install/<pkg_name>/share/<pkg_name>/
, will have a copy of your launch directory in it.
If you do colcon build --symlink-install
, then instead of a copy of the launch file it will put a symbolic link to the launchfile. This means that if you change something to the launch file in your package you don't have to rebuild the package for the changes to take effect. This is only true for files that don require compilation, so --symlink-install
will work for config files or python code / launch files etc.