How to handle cloned packages that have no package.xml or CMake.txt file in ROS workspace.
Say I git cloned a repo into my src folder within my workspace. I am unable to catkin build it because it does not have a package.xml nor a CMake file. Essentially, I want to write a python script to import and use this cloned package, but it won't be recognized without building it. Is my only solution to create a package.xml and CMake file for the package and then build it? I am using Ubuntu Focal Fossa with a Noetic ROS distro.
Asked by mikevillan on 2023-04-05 22:32:36 UTC
Answers
You likely need to have CMakeLists.txt and package.xml file to build a package.
src folder only gives you source code. However, a package still needs CMakeLists.txt and package.xml to provide information about things like build or runtime dependencies, required CMake verion, libraries/executables to build, etc... (http://wiki.ros.org/catkin/CMakeLists.txt).
Since each package is very specific, I think you would need to write them. You may want to start by adding contents from a basic template provided on the ROS tutorial page.
Asked by GuimingChen on 2023-04-05 23:33:52 UTC
Comments
That is pretty much what I figured, I was just hoping there was another way. The package is graph-tool which is basically C++ code with a python wrapper and so I've heard a lot of people having trouble using it and there is a post on here about using it in ROS, but it has yet to be answered. Thank you!
Asked by mikevillan on 2023-04-06 20:11:35 UTC
It is unclear what your goal is.
Do you understand the distinction between a "system package" and a "ros package"?
It's common for a ros package/node to depend on a system package/library. A system package is built outside of the ros world, and is typically installed as a library somewhere in /usr
. Your ros node then uses this library.
If the library you want to use is available through ubuntu apt
or pip
, you should simply be declaring this system dependency in the CMakeLists.txt file for your ros package.
Asked by Mike Scheutzow on 2023-04-08 09:16:21 UTC
Comments
Sorry for the comment noise. The comment got long enough that I changed it to an answer.
Asked by Mike Scheutzow on 2023-04-08 09:06:03 UTC