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

Using git for version control with catkin (added>>>) and Eclipse

asked 2015-08-27 22:02:11 -0500

Rud gravatar image

updated 2015-08-28 15:15:17 -0500

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/<project>" 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.

edit retag flag offensive close merge delete

Comments

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.

joq gravatar image joq  ( 2015-08-28 15:39:30 -0500 )edit

joq - you are correct in part. It depends on where you run the 'cmake' command line. I was running it in the src/<project> 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/<project>. That puts all the extra files in build.

Rud gravatar image Rud  ( 2015-08-29 21:37:10 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-08-29 22:11:19 -0500

Rud gravatar image

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.

edit flag offensive delete link more
7

answered 2015-08-28 00:45:01 -0500

gvdhoorn gravatar image

updated 2015-08-28 06:23:48 -0500

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-08-27 22:02:11 -0500

Seen: 2,407 times

Last updated: Aug 29 '15