ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Do I need to build a downloaded package?

asked 2019-05-29 21:51:01 -0600

Sparkle Eyes gravatar image

updated 2019-05-30 20:04:12 -0600

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. Do I need to run catkin_build somewhere?

Thanks!

Edit!!!

I realized this folder is not a ROS package since it does not have src and buildand devel space. But still, if it has, do I need to run catkin_build again?

Edit again!!!

For this particular package (?), the author published it in a docker environment with something called racker that I couldn't get running on my laptop, because racker only works with Python 3 and all my ROS stuff are in Python 2. That's why the README in this project does not work for me and I am trying to build things locally "in my own way".

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2019-05-30 01:41:51 -0600

gvdhoorn gravatar image

updated 2019-05-30 01:51:32 -0600

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 buildand 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.

edit flag offensive delete link more

Comments

Wow, thanks so much for the detailed answer! I actually tried the whole catkin build process myself yesterday, but had to initialize a new workspace first, create packages there, and then copy the CMakeLists.ext and the packages.xml files from the cloned folder into that new clean workspace, so I know I have the correct structure. But your explanations on the whole workflow helps a lot!!! Also the catkin_make and catkin build tools --- I understand them as two tools but am not familiar enough to tell them apart...

Sparkle Eyes gravatar image Sparkle Eyes  ( 2019-05-30 20:08:23 -0600 )edit

As for the specific use-case, this is a demo program distributed in a docker environment, which I cannot build successfully on my laptop, so I decide to "go raw" and build the source myself....

Sparkle Eyes gravatar image Sparkle Eyes  ( 2019-05-30 20:09:02 -0600 )edit
0

answered 2019-05-29 23:02:29 -0600

vunguyen gravatar image

You need to follow the instructions in the README.md especially those for building and running the software.

edit flag offensive delete link more

Comments

3

Many ROS packages you can find online will not contain instructions on how to build them as the author either hasn't provided them or he assumes users will be familiar with the necessary steps. I've added some more detail in my answer.

gvdhoorn gravatar image gvdhoorn  ( 2019-05-30 01:46:04 -0600 )edit

Thank you for the comment. For this particular package (?), the author published it in a docker environment with something called racker that I couldn't get running on my laptop, because racker only works with Python 3 and all my ROS stuff are in Python 2. That's why the README in this project does not work for me and I am trying to build things locally "in my own way". I'll add this in the question.

Sparkle Eyes gravatar image Sparkle Eyes  ( 2019-05-30 20:03:41 -0600 )edit

something called racker

@Sparkle Eyes: do you mean rocker?

gvdhoorn gravatar image gvdhoorn  ( 2019-05-31 01:15:37 -0600 )edit

@gvdhoorn Thanks for the reply and I probably missed your reply. Yes, that's what I was referring to.

Sparkle Eyes gravatar image Sparkle Eyes  ( 2019-07-08 11:08:02 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-05-29 21:51:01 -0600

Seen: 786 times

Last updated: May 30 '19