Robotics StackExchange | Archived questions

How to use rosdep to install dependencies of a ROS 1 install folder (built by Colcon)

I'm trying to build a Docker image that only has my install workspace, but I cannot get the dependencies to install. With the src folder present I would use rosdep install, but when I use colcon build in an intermediate container and only copy the install folder to my deployment image, rosdep install --default-yes --from-paths install --ignore-src -r does not install my unmet dependencies.

Asked by MikeWrock on 2021-01-12 00:18:19 UTC

Comments

You tagged this ROS1 and then mention Colcon. Are you using Colcon to build a ROS 1 workspace?

Asked by gvdhoorn on 2021-01-12 02:41:05 UTC

Yes, I have been using Colcon to build a ROS 1 workspace. Could that be the reason rosdep install won't install my dependencies?

Asked by MikeWrock on 2021-01-12 02:50:03 UTC

It would be good if you could show what does happen when you run your command. A verbatim copy-paste of rosdep's output would be good.

Asked by gvdhoorn on 2021-01-12 02:56:45 UTC

I've just tested this with ros:melodic and a simple pkg depending on industrial_msgs (which is released but not part of ros:melodic).

After building everything in one container, then using the install folder in another ros:melodic container and the following rosdep command:

rosdep check --from-paths /path/to/catkin_ws/install -i --rosdistro=melodic

and rosdep correctly identified industrial_msgs to be missing.

This was with catkin_tools as the buildtool.

So this can work.


Edit: tried with colcon build --merge-install and without --merge-install and that changes things. rosdep does find the pkg, but doesn't seem to find anything missing.

Asked by gvdhoorn on 2021-01-12 03:04:52 UTC

Not sure, but I just remembered this could be due to ros-infrastructure/rosdep#724 (although that's specifically about ROS 2 and rosdep, Colcon is used there as well, which may be a common factor). Could also not be related at all.

Easiest work-around for now: not using Colcon to build a ROS 1 workspace. It's actually not really a work-around: I don't believe there is a claim that Colcon can build all ROS 1 workspaces successfully. It's not officially supported.

Asked by gvdhoorn on 2021-01-12 03:19:12 UTC

If I understand what you're trying to do correctly, you may be interested in ros-infrastructure/rosdep#789, which allows you to ask rosdep to only install exec_depends, instead of all dependencies.

Asked by gvdhoorn on 2021-01-12 03:58:20 UTC

Final comment: your rosdep invocation includes the -r switch.

This will make rosdep ignore errors it may encounter while trying to install dependencies. It's up to you, but I would want to know when rosdep cannot install a specific dependency instead of just ignoring it, as it's probably something I would want to address.

I would suggest to remove the -r there.

Asked by gvdhoorn on 2021-01-12 13:18:45 UTC

Answers

I'm not sure what the cause is yet, but the following works for me (ie: rosdep identifies the missing dependency correctly) with a ROS 1 workspace (ie: with Catkin packages) built by Colcon (in a ros:melodic container):

rosdep check --from-paths /path/to/catkin_ws/install/share --ignore-src --rosdistro=melodic

Note the share/ in the argument to --from-paths.

Without that, rosdep for some reason doesn't identify the missing dependency.

It does discover my test package though, so I'm not sure what's going on there.

Running with --verbose gives me:

resolving for resources [test_pkg]

when adding the share/, but:

resolving for resources []

without share/.

It's likely there is already an issue on ros-infrastructure/rosdep about this, but I haven't found it (yet) (edit: could actually be ros-infrastructure/rosdep#724).

Note: this is with --merge-install. I expect you'd have to list the paths to all share/ subdirs of all the pkgs in your workspace (ie: install/$pkg/share) otherwise.


Edit: this probably has something to do with rosdep only looking at the Ament Index when parsing workspaces built by Colcon, and only looking for files under share/ (and failing if they're not where it expects them to be), instead of crawling the hierarchy below catkin_ws/install.

Asked by gvdhoorn on 2021-01-12 03:46:21 UTC

Comments

Thank you very much, this solved my issue. Should I add a minimal working example in case someone else is stuck in a similar situation or do you think your answer gives sufficient information to reproduce the desired result?

Asked by MikeWrock on 2021-01-12 12:46:00 UTC

You have a pretty niche use-case (building a ROS 1 workspace with Colcon). I would expect users who do that to understand the build workflow a bit better than others.

I believe the rosdep command I show as part of the answer is clear enough, in combination with the explanation below it.

if you feel providing a variant with install instead of check would help, you could post a comment here.

Asked by gvdhoorn on 2021-01-12 13:16:25 UTC

Could you please mark the question as answered by ticking the checkmark (✓) to the left of the answer if you feel it has been answered? Thanks.

Asked by gvdhoorn on 2021-01-12 13:16:55 UTC