Dear community, I'm unsure how to use a third-party package I downloaded online from Github: https://github.com/osrf/car_demo
Inside this folder, the car_demo
folder has the structure of a ROS package. After downloading it, how do I let me local version of ROS know the existence of this package? e.g. use roscd
to this particular package.
If you git clone
a ROS package (or multiple packages) from an online repository then you must build that in a Catkin workspace, yes.
A large number of ROS packages will be written in a language that needs to be compiled (such as C++) before you can use the resulting nodes (ie: binaries), so without compiling, you only have a set of source files and headers. Not something you could rosrun
or roslaunch
.
Do I need to run catkin_build
somewhere?
As part of the process of building a Catkin workspace, you'd run catkin_make
, indeed (not catkin_build
).
Or, if you'd like, you could install catkin_tools
and run catkin build
(note: no underscore).
I realized this folder is not a ROS package since it does not have src
and build
and devel
space.
ROS packages do not have build
and devel
folders, only Catkin workspaces do.
In fact: if you ever see a repository that does contain build
and devel
folders, the author has essentially made a mistake, as those folders should never be added to a VCS.
As to the process of building packages that you downloaded the sources for from some online repository: please refer to the answer of #q252478 for an example workflow.
In general it is not sufficient to simply copy the sources in a Catkin workspace and then running catkin_make
(or catkin build
), as your system wouldn't have the necessary dependencies installed. Without those dependencies the build will fail.
Provided the author of the package you intend to build has done a proper job and has listed all build and run dependencies correctly in his package manifest (ie: package.xml
), the workflow shown in #q252478 should install them all for you.
With the dependencies installed, running catkin_make
(or catkin build
) is the last step then.
Edit: and finally: please always consider whether you need to build a package from source. In many cases packages have been released through the ROS buildfarm, which means that a simple sudo apt install ros-<rosdistro>-package-name
will install everything for you.
Using binaries is always preferable over building things from sources, unless you know what you are doing or have a specific need.