How do I use rosdep install to install individual dependencies?
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.
Asked by DanRose on 2020-04-02 14:21:36 UTC
Answers
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/issues/724)
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
Asked by marguedas on 2020-04-02 15:42:15 UTC
Comments
I think your disclaimer/issue is the crux of my confusion.
Asked by DanRose on 2020-04-02 16:28:45 UTC
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.
Asked by tfoote on 2020-04-02 18:41:02 UTC
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.
Asked by stevemacenski on 2020-04-02 15:48:40 UTC
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.
Asked by DanRose on 2020-04-02 16:31:40 UTC
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
Asked by stevemacenski on 2020-04-02 16:43:31 UTC
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.
Asked by DanRose on 2020-04-02 18:11:38 UTC
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
.
Asked by tfoote on 2020-04-02 18:38:54 UTC
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.
Asked by stevemacenski on 2020-04-02 19:19:40 UTC
Comments
Just to clarify what the question is: you want to install the package
rviz2
or the dependencies of the packagerviz2
?Asked by marguedas on 2020-04-02 15:17:09 UTC
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.
Asked by DanRose on 2020-04-02 15:23:38 UTC