Specifying ROS catkin dependencies

I’m following the excellent Kyrofa’s guide for snapping my ROS Indigo workspace and I’m having a (very newbie) problem in the early stages of the process.

I’m getting this problem when creating the snap.

Determining system dependencies for Catkin packages...
ERROR: no rosdep rule for 'mobile_base_navigation'
Package 'mobile_base_navigation' isn't a valid system dependency. Did you forget to add it to catkin-packages? If not, add the Ubuntu package containing it to stage-packages until you can get it into the rosdep database.

This is my snapcraft.yaml file:

name: mobile-base-snap
version: '0.1'
summary: Trying to snap the complete workspace.
description: That's all.

grade: stable
confinement: devmode

    command: roslaunch mobile_base_snap mobile_base_snap.launch --screen
    plugs: [network, network-bind]
    daemon: simple

    plugin: catkin
    rosdistro: indigo
    catkin-packages: [mobile_base_snap]

By the other hand, mobile_base_snap.launch simply call a launch file in the package mobile_base_navigation that brings up the whole system. So here I’m basically trying to copy the structure created in the guide, however, the packages used there are “system dependencies” (kobuki_node and kobuki_random_walker are reachable by rosdep) and here are my own packages… what am I missing?

Thanks in advance.

Thanks for bringing the conversation here, @mbeneto.

rosdep is a ROS tool that Snapcraft uses for two purposes:

  1. To determine the dependencies of a given ROS package
  2. To resolve a given dependency into a system dependency (i.e. something you install via apt).

The flow looks like this:

For each catkin-package you specify:

  1. Obtain its dependencies via rosdep keys
  2. Compare the results to the list of catkin-packages specified. For each key not satisfied by another item in catkin-packages:
    2a. Assume it’s a system dependency, and try to resolve it as such. If it resolves, fetch it as if it were a stage-package. If it doesn’t, it either isn’t supposed to be a system dependency, or it’s simply missing from the rosdep database.

In the guide to which you refer, kobuki_node and kobuki_random_walker are dependencies that rosdep resolves into system dependencies, which you can see by running rosdep yourself:

$ rosdep resolve kobuki_node
$ rosdep resolve kobuki_random_walker

In your case, mobile_base_navigation is (presumably) a package contained within your workspace. However, since you didn’t specify it in catkin-packages, Snapcraft assumes you expect it to be a system dependency, which it’s not, so it bails with the message you saw.

catkin-packages should be a list of all packages in the workspace you want built as part of the snap. It sounds like you simply need to add mobile_base_navigation to that list.

I recently received a request for the ability to simply build everything in a given workspace. It seems that you would likely benefit from this feature.

1 Like

Hi @kyrofa thanks for your fast and detailed reply.

It comes out that I had already tried to add that package to the catkin-packages list before asking here, but as I said in your blog I also tried to add it to the CMakeLists.txt and maybe that’s why it wasn’t working.

After receiving your answer, I added that package to the list, as well as other catkin packages that needed to be built. I have to recognise that after following step by step your Kobuki tutorial successfully I thought this was performed “automagically” from the launch file (I know the snaps system intends to be easy but maybe that was too much :sweat_smile:). Now that I know it, probably that feature request you mention is useful for me so I marked myself as also affected.

Finally, I could successfully generate the snap but I encountered another problem:

while processing /snap/mobile-base-snap/x1/opt/ros/indigo/share/mobile_base_navigation/launch/start_all.launch:
Invalid roslaunch XML syntax: [Errno 2] No such file or directory: u'/snap/mobile-base-snap/x1/opt/ros/indigo/share/mobile_base_navigation/launch/start_all.launch'
The traceback for the exception was written to the log file

Fortunately, in this case I think I know what is happening (correct me if I’m wrong, please). So far I was compiling, distributing and also executing the code from the workspace, that’s why it wasn’t necessary to export/install some of the packages “dependencies”. However, when creating a snap, an empty workspace is created and all the packages are installed along with its dependencies according to their CMakeLists.txt. So, if there’s no launch file or library (or other artefacts) installed/exposed in that file, that’s not going to be at the resulting snap, returning me this nice error I posted above.

Yeah I suspect you’re correct. Working straight from the devel space is super common in ROS projects, so it’s easy to ignore install rules. When it comes to packaging, though, the only way Snapcraft (or really any packaging system) knows what to put into the resulting package is via your install rules. Let’s say your package includes a launch directory. To install that entire directory to the correct place, you need an install rule that looks like this:

install(DIRECTORY launch