Possible to build with catkin plugin with git source?

I’m wondering if there’s any way to build ROS packages directly from git. Something like:

    plugin: catkin
    source: https://github.com/ThomasTimm/ur_modern_driver.git
    - ur_modern_driver
    rosdistro: kinetic
    include-roscore: true

The problem with this is that the catkin plugin requires this package to be in parts/ros-part/src/src/ur_modern_driver, but snapcraft checks out the git repository directly into parts/ros-part/src/. Is there a way to instruct it to check out into subdirectories? (I couldn’t find one) Any other ideas?

Being able to do this in an underlay would be a nice way to include ROS dependencies that haven’t been packaged into debs (like the example above).

Unfortunately, Catkin, and by extension the Catkin plugin in snapcraft, does not work this way. It requires the use of workspaces, and then operates on the workspace. Since the ur_modern_driver repo is a package and not a workspace, the Catkin plugin doesn’t know how to build it. However, you can easily create a workspace that includes it by using rosinstall files. For example, in the root of your project (alongside the snap/ dir) create a file called my-stuff.rosinstall with the following contents:

- git:
    local-name: ur_modern_driver
    uri: https://github.com/ThomasTimm/ur_modern_driver.git

Then make your YAML snippet look like this:

    plugin: catkin
    rosdistro: kinetic
    rosinstall-files: [my-stuff.rosinstall]
      - ur_modern_driver

The Catkin plugin will then merge this rosinstall file in with its workspace, giving Catkin something it can walk and use to build. Note that master of ur_modern_driver doesn’t seem to build, but you get the idea.

1 Like

Ah yes, that’s a nice solution. Thanks!

Is this still the way to go?

I’m having problems pulling my repository defined in the rosinstall file. In an example where I have the catkin_simple package as dependency, this gives me:

Installing wstool...
Initializing workspace (if necessary)...
Merging /root/parts/workspace/src/snap/local/snap.rosinstall
Updating workspace...
The authenticity of host 'github.com (' can't be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? yes
Error updating workspace: Cloning into '/root/parts/workspace/src/src/catkin_simple'...
warning: templates not found /usr/share/git-core/templates
Warning: Permanently added 'github.com,' (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ERROR in config: Error processing 'catkin_simple' : [catkin_simple] Checkout of git@github.com:catkin/catkin_simple.git version None into /root/parts/workspace/src/src/catkin_simple failed.

I access the dependencies by SSH:

- git:
    local-name: catkin_simple
    uri: git@github.com:catkin/catkin_simple.git

Normal git clone commands work just fine on my machine. Do I need to give my SSH key to the VM somehow?