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

git strategy for catkin and package folders

asked 2017-03-25 02:48:16 -0500

knxa gravatar image

I am new to ROS and the catkin tool. I have read the tutorials and try to understand how to work with the ROS file structure and tools. Let's say my application will consist of home grown packages a,b and c.

workspace_folder/
  src/
    CMakeLists.txt/
    package_a/
    package_b/
    package_c/
  1. I could place these packages in separate git repositories, but I feel that would be inconvenient as the number grows and as many of them will be very application specific.
  2. Should I place the src folder in git instead? What about the CMakeLists.txt file then? I guess that file is system specific.
  3. Or do you recommend to make the full work space folder as repository and just make git ignore the build and devel folders?

For each solution I am interested in the instructions that a new developer would need to checkout and build the application. For instance I am somewhat in doubt about what catkin (e.g. catkin init work space) does behind the scenes and how much of this should be in git.

Thanks for any advice

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
12

answered 2017-03-25 18:08:00 -0500

Dirk Thomas gravatar image

I could place these packages in separate git repositories, but I feel that would be inconvenient as the number grows and as many of them will be very application specific.

All packages in a single git repository must be released together. So if you find a bug in one package and would like to release a new patch release you will need to release the other packages in the same repo too even though they havent' changed.

It basically comes down to how closely related the packages are. If they are tightly coupled you should keep them in a single repo. If they are not (e.g. the packages are for completely different and unrelated application) you might better keep them in separate repos.

Should I place the src folder in git instead? What about the CMakeLists.txt file then? I guess that file is system specific.

No, the workspace itself (the src folder and the CMakeLists.txt file in the root of the source space) should not be part of your repository. The rational is that users might want to clone your repository together with other repositories and build them together in a workspace. That wouldn't be possible if your repo already contains this. Also the CMakeLists.txt file only applies to the case when you are using catkin_make. But there are other build tools (e.g. catkin_make_isolated and catkin_tools) which don't use that file.

Or do you recommend to make the full work space folder as repository and just make git ignore the build and devel folders?

Neither nor. You either want: * package_a, package_b, and package_c to be three separate repositories or * if of put all three packages into a single repository clone that repo in your src folder:

workspace_folder/
  src/
    repo_containing_pkgs/  <-- git repo
      package_a/
      package_b/
      package_c/

The src folder should always be created by the user when he creates a workspace and decides what sources to put into that workspace.

For each solution I am interested in the instructions that a new developer would need to checkout and build the application. For instance I am somewhat in doubt about what catkin (e.g. catkin init work space) does behind the scenes and how much of this should be in git.

The workflow usually looks like this:

  • The user creates workspace_folder/.
  • The user creates workspace_folder/src/.
  • The user populates the source space of the workspace with whatever packages he wants to build. There are multiple options how to do that:
    • The user manually calls git clone / hg clone / svn checkout / <download a="" tarball="" and="" unpack="" it=""> / whatever else you want to imagine.
    • The user uses the tool rosinstall_generator to collect a list of repositories and uses a tools like wstool or vcstool to fetch a set of repositories. This can e.g. be used to build a full ROS distribution (see from-source instructions).
  • Build the workspace with any of the build tools (catkin_make, catkin_make_isolated, catkin_tools).

If you don't want users to build your packages from ... (more)

edit flag offensive delete link more

Comments

Thank you. Nice answer. Appreciate it. I guess I just don't yet understand what catkin does and relies on. E.g. how use catkin_create_pkg to create package_b in this structure?:

  workspace_folder/
    src/
      my application folder  <-- git repo
        package_a/
        package_b/
knxa gravatar image knxa  ( 2017-03-26 10:32:12 -0500 )edit

catkin is being used in the CMake file of each of the packages and it help you build the package. It basically make it easier to pass the information from one package to the next package if they depend on each other.

Dirk Thomas gravatar image Dirk Thomas  ( 2017-03-26 11:21:10 -0500 )edit
1

In your example you need to go to the folder "my application folder" and invoke "catkin_create_pkg" which then creates the subfolder "package_b".

Dirk Thomas gravatar image Dirk Thomas  ( 2017-03-26 11:22:03 -0500 )edit

Thanks a lot for your clear explanations.

knxa gravatar image knxa  ( 2017-03-26 13:03:48 -0500 )edit
2

I am guessing I should also not include the build and devel folder on GitHub? Thanks.

superkuo gravatar image superkuo  ( 2019-10-12 02:33:03 -0500 )edit
1

I believe that is correct. Can anyone confirm?

rational_galt gravatar image rational_galt  ( 2019-12-19 11:06:56 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2017-03-25 02:48:16 -0500

Seen: 8,514 times

Last updated: Mar 25 '17