0
$\begingroup$

Rosanswers logo

I am new to ROS, catkin, and git. I'm trying to setup my system properly for version control, and for working on my laptop and desktop machines using a central git repository.

I found an question and answer from earlier pre-catkin about what to put in the .gitignore file. I assume there are a number of catkin files and directories that should be ignored because they are either not necessary or would actually cause conflicts if clones onto the wrong system.

What should be ignored for catkin?

Any other suggestions on using git with ROS?

Addendum:

After reading the answer I realized my question was incomplete. I am using Eclipse and setup the project running the catkin command in the "src/" directory:

cmake  -DCMAKE_INSTALL_PREFIX=../../install -DCATKIN_DEVEL_PREFIX=../../devel -G"Eclipse CDT4 - Unix Makefiles"

This creates a number of files and directories. So my question is which of those files or directories should be excluded from git.


Originally posted by Rud on ROS Answers with karma: 133 on 2015-08-27

Post score: 0


Original comments

Comment by joq on 2015-08-28:
The paths you listed are outside the git repo. Whatever Eclipse creates is a question for them, not for ROS answers. The simplest solution might be to try it and then see what git status says.

Comment by Rud on 2015-08-29:
joq - you are correct in part. It depends on where you run the 'cmake' command line. I was running it in the src/ directory. I re-read many of the sites on setting up Eclipse and found that I could or should have been running it in build/. That puts all the extra files in build.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

What should be ignored for catkin?

Catkin (really CMake) does out-of-source builds (see CMake FAQ - Out-of-source build trees in the CMake FAQ). This means that, in contrast to rosbuild, your source tree will not be polluted with build artefacts each time you compile your packages.

As long as you only store the sources of your packages in your VCS (so not your entire catkin_ws directory), you should not need to add anything special to ignore Catkin related files.

Whether you want to ignore some additional files is then entirely up to you.


Edit: one thing I do tend to add to my .gitignore files is the mongodb created by MoveIt when you run a launch file from your MoveIt config that uses a database. These can become very large (4GB+) and you typically don't version those. Adding a line like default_warehouse_mongo_db/ should fix that.

Edit2: another would be CATKIN_IGNORE files. Just so you can selectively 'hide' packages in your workspace. But with the support for black/white listing packages in catkin_tools, I've not used that too much recently.


Originally posted by gvdhoorn with karma: 86574 on 2015-08-28

This answer was NOT ACCEPTED on the original site

Post score: 7

$\endgroup$
0
$\begingroup$

Rosanswers logo

The answer and comment in response to my question pointed me in the right direction, namely that I was setting up packages to use with Eclipse improperly. As I mentioned in a comment I was putting the Eclipse project in the src/<package> directory when it should have been in the build/<package> directory. That put all the catkin files and directories in the 'build' instead of 'src'. With those in the proper place putting the entire 'src' directory under version control is possible.

To contribute something for others here is a script I use to create a package for use with Eclipse. You can put it and run it from anywhere because it switches to the catkin workspace directory. Be sure to change the script to your workspace. The sole parameter is the name of the new package. The script:

    #!/usr/bin/env bash
clear

cd ~/development/ros  <<<== change!!
cd src
echo

echo create package
catkin_create_pkg $1 std_msgs roscpp
echo
pwd

echo setup project for eclipse
pwd
cd ../build
mkdir $1

echo
pwd
cd $1
cmake ../../src/$1 -DCMAKE_INSTALL_PREFIX=../../install -DCATKIN_DEVEL_PREFIX=../../devel -G"Eclipse CDT4 - Unix Makefiles"

echo
echo set debug in build
cd ..
cmake ../src -DCMAKE_BUILD_TYPE=Debug

echo
echo back up to catkin worksapce
cd ..
catkin_make

Once it is run import the project to Eclipse from the build/<package> directory.


Originally posted by Rud with karma: 133 on 2015-08-29

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.