Ask Your Question
0

How do I use rosdep install to install individual dependencies?

asked 2020-04-02 14:21:36 -0600

DanRose gravatar image

updated 2020-04-02 15:14:55 -0600

Please explain rosdep install to me.

I'm very used to using rosdep with the --from-paths option, but how do I use it without that, to install dependencies individually?

There are some terms in rosdep --help text that I don't understand. What is the difference between a "stack", a "package", a "resource", a "rosdep", and a "key"?

Should I be able to rosdep install rviz2 or rosdep install libqt4? Both fail with a "missing resource" error.

edit retag flag offensive close merge delete

Comments

Just to clarify what the question is: you want to install the package rviz2 or the dependencies of the package rviz2 ?

marguedas gravatar image marguedas  ( 2020-04-02 15:17:09 -0600 )edit

Either. I chose these two as examples because one is a ROS package and one is a system dependency. I expect the command to do something but I don't understand what resource is missing.

DanRose gravatar image DanRose  ( 2020-04-02 15:23:38 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-04-02 15:42:15 -0600

marguedas gravatar image

updated 2020-04-03 04:09:55 -0600

My understanding is that "stack and packages" are ROS packages that are on your ROS_PACKAGE_PATH. By default RPP just points to your ROS installation so you'd expect to already have all the dependencies of those packages installed. So if there is no package.xml on your RPP with the name you request, commands like rosdep install will return "resource missing"

By opposition "rosdeps" are things that are in your rosdep cache, they can be rosdep keys for system dependencies or ROS package names that are released in a given rosdistro.

When to use rosdep install <package_name> ?

Disclaimer: It's unclear to me what the correct ROS2 way of using it is as ROS2 it's not supposed to rely on RPP but AMENT_PREFIX_PATH instead (https://github.com/ros-infrastructure...)

rosdep install <package_name> comes in handy when you have an entire workspace of cloned repositories but you only want to install the dependencies of some packages.

So if you have a workspace with let's say the rviz2 and the navigation2 repositories but want to install only the dependencies of the package named rviz2, you'll - add your ws directory to the RPP

export ROS_PACKAGE_PATH=/my/ws:$ROS_PACKAGE_PATH

- install rviz2 dependencies

rosdep install rviz2

This will install the dependencies of the package names rviz2 but not the others.

If you run the same command but adding --from-paths /my/ws it will install all the deps of the workspace

Edit: there are likely other use cases for it but that's the only case I ever had to use rosdep install without --from-paths

Edit 2: an alternative I use often for ROS 2 when I have the full ros2.repos cloned but want to install only the dependencies I need for my build is to ask colcon to give me the list of paths. E.g. the following command allows me to install all the dependencies to build rviz2 and it's' dependencies

rosdep install -y --from-paths `colcon list --packages-up-to rviz2 -p` --ignore-src
colcon build --packages-up-to rviz2
edit flag offensive delete link more

Comments

I think your disclaimer/issue is the crux of my confusion.

DanRose gravatar image DanRose  ( 2020-04-02 16:28:45 -0600 )edit

The basic answer is that you need to pass it the search path where to look for source packages. We used ROS_PACKAGE_PATH in ROS 1. Now we just recommend that you use --from-path directly instead of using the indirection to find your source packages. Anything that's system installed or in an underlay should be in your ament index.

tfoote gravatar image tfoote  ( 2020-04-02 18:41:02 -0600 )edit
0

answered 2020-04-02 15:48:40 -0600

updated 2020-04-02 15:49:53 -0600

I'm going to assume you've at least read: http://wiki.ros.org/rosdep

from-paths is going to let you install all the dependencies in the path defined. So if /src/ then it'll recursively look at the package's package.xml files, look up the keys, and install them such that you can then build whatever package in your /src/ directory.

If you do something like rosdep install --from-paths rviz2, what you're asking is: Can you please install all the dependencies in the directory rviz2 relative to run dir? To my understanding, just ask rosdep install <pkg>, requires that <pkg> is in your ROS_PACKAGE_PATH, which won't be the case if you haven't built it before.

The ignore-src is to make it so you don't install binaries of packages you've built yourself. r and q I think are self explaining.

edit flag offensive delete link more

Comments

I don't know what a ROS_PACKAGE_PATH is. I think @marguedas may have nailed the issue that rosdep install <pkg> is currently incompatible with ROS2. I'm still not sure if I should expect it to be able to install system requirements individually, though.

DanRose gravatar image DanRose  ( 2020-04-02 16:31:40 -0600 )edit

Its not that its incompatible, its just that ROS2 doesnt populate that path. However, you will still run into the same issues if you're using rosdep install <pkg> if that pkg isn't already installed on your system. At the time which its installed, you've already downloaded the dependencies so that's not a super compelling use-case. What you are asking for is a way to install the dependencies of some <pkg> you have before you build, for which the from-paths option is the right option regardless of ROS1 or ROS2.

stevemacenski gravatar image stevemacenski  ( 2020-04-02 16:43:31 -0600 )edit

If ROS2 doesn't provide the metadata needed for it to work, that's an incompatibility... And if the answer is "this is never the right feature of the tool to use" it kinda begs the question "why is this feature in the tool?" I'm trying to understand what my tools can do and how they work.

DanRose gravatar image DanRose  ( 2020-04-02 18:11:38 -0600 )edit

The packages for which you are asking rosdep to install the dependencies for need to either be in your active ament index, your ROS_PACKAGE_PATH (legacy for ROS 1) or passed in a search path using --from-path.

tfoote gravatar image tfoote  ( 2020-04-02 18:38:54 -0600 )edit

I general, the most useful and consistent method is always from paths. As Tully points out, there's other mechanisms to do it, but functionally there's not a ton of use. If its in the path, its usually an installed version from binaries or in your install space. I'm sure you can append source paths to these paths if you like, but that's not going to be good form, IMO.

stevemacenski gravatar image stevemacenski  ( 2020-04-02 19:19:40 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-04-02 14:21:36 -0600

Seen: 119 times

Last updated: Apr 03