It's important to add all of your dependencies to the package.xml. That does a few different things:
- For users who are building your package from source, it lets
rosdep
know which packages to install from the system. - If you end up building your package on the ROS 2 buildfarm (https://build.ros2.org), it needs to be in there so that the dependencies are available when it is built.
- If you end up building your package on the ROS 2 buildfarm, it sets up the debian package dependencies properly so that
apt-get install ros-foxy-<mypackage>
installs all of the dependencies.
That being said, adding to the package.xml doesn't modify your environment at all. So it won't help your python package to "find" dependencies. Essentially if you can run python3
and import <dep>
, then your package should be able to find it. Typically those are either from system packages, or through pip.
Btw, this question was asked here as well but didn't receive an answer: https://answers.ros.org/question/3656...
Just following up... It doesn't seem like it did anything to add it to package.xml, although I saw this in some Github repos. I think I will just use a venv / requirements.txt, although I'm not sure that this is the best approach.
We spent a little time documenting this a bit more, maybe this will help: https://index.ros.org/doc/ros2/Tutori...
Thanks so much for the documentation!! I'm guessing you meant to link to https://index.ros.org/doc/ros2/Tutori...