How to specify launch file path in snap creation?
I am having trouble getting a snap of my ROS package to work correctly. After creating the snapcraft.yaml
file, successfully generating the snap and installing it, I get this message when trying to run the ROS package:
This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- libpsm_infinipath.so.1
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.
The command 'roslaunch' for 'roslaunch ROS_PACKAGE launch_file.launch' was resolved to 'opt/ros/melodic/bin/roslaunch'.
The command 'roslaunch ROS_PACKAGE launch_file.launch' has been changed to 'opt/ros/melodic/bin/roslaunch ROS_PACKAGE launch_file.launch'.
Snapping |
Snapped snap-name_0.1_amd64.snap
(venv) user@computer:~/catkin_ws/src/ros_package$ sudo snap install --devmode --dangerous *.snap
snap-name 0.1 installed
(venv) user@computer:~/catkin_ws/src/ros_package$ snap-name
RLException: [launch_file.launch] is neither a launch file in package [contamination_mapping] nor is [contamination_mapping] a launch file name
The traceback for the exception was written to the log file
Could anyone suggest what might have gone wrong in the process?
I see this type of error most often as a result of missing installation rules. Double check that you're actually installing that launch file in the CMakeLists.txt.
Thanks very much! I have this in CMakeLists.txt. Is this right?
Also, I've just seen the following in the messages I get at the end of snap creation:
No packages found in source space
. Does this offer any clues?Yeah it does. When you're building a snap, snapcraft needs to operate on a workspace. That message makes me think maybe you're trying to get it to build a single package, is that true? You need to point it at either a workspace or a rosinstall file (and it'll create a workspace before merging that rosinstall file in).
Yes that's right I was trying to build a single package. What folder should the
snapcraft.yaml
and.rosinstall
file be in? For the.rosinstall
file, would this just contain the following?- git: {local-name: my_ros_package, uri: 'https://github.com/user/my_ros_package.git', version: master}
Also, on the snap tutorial here, I seemed to think that the
snapcraft.yaml
was just referencing the ROS package Github repository and I didn't need the whole local workspace. Maybe I'm misunderstanding?Yeah the snap tutorial cheats a little. It pulls down that github repo, but then it tells catkin that instead of the source-space being the default
src
subdirectory, it's theroscpp_tutorials
subdirectory, and thus catkin happily proceeds as if it were operating on a workspace. You can do a similar thing if you like that better than a rosinstall file, but I'll give more rosinstall details in my answer shortly as its a bit more generically useful (doesn't require your repo to be structured in any particular way).