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

Using version control git for ROS development

asked 2011-03-03 05:26:33 -0600

alfa_80 gravatar image

updated 2011-03-03 05:41:33 -0600

Eric Perko gravatar image

Hi,

I am in favor of git in using version control. I would like to know the best practise to do it since I have my own node (myNode) in /opt/ros/diamondback/stacks/myNode.

Should I wrapped the myNode folder/node with repo01.git(for example)? I mean the path now becomes /opt/ros/diamondback/stacks/repo01.git/myNode.

Is there any better way doing it?

Thanks in advance..

-alfa-

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
5

answered 2011-03-03 05:43:21 -0600

makokal gravatar image

Usually one does not write new nodes or code in the /opt/ros/<distro_release>/stacks/ area, but rather somewhere on the system when permissions are not an issue, e.g in the /home/<user>/, then you can let ros know of these packages but just doing export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:<path_to_own_packages>. For version control, say git one can then easily set up using git init in the say /home/<user>/packages directory.

edit flag offensive delete link more

Comments

Thanks a lot makokal :-)
alfa_80 gravatar image alfa_80  ( 2011-03-03 06:49:49 -0600 )edit
11

answered 2011-03-03 15:52:27 -0600

updated 2011-03-03 15:55:30 -0600

We use git for our version control and this is what we do:

  1. First, make sure you get familiar with the concepts of repositories, stacks, and packages as they pertain to ROS:
    http://www.ros.org/wiki/Repositories
    http://www.ros.org/wiki/Stacks
    http://www.ros.org/wiki/Packages
  2. Name your repository. The accepted model is to name it something along the lines of "foo-ros-pkg". If the repo is part of an institution, like a company or a university, "foo" can be the name of that group. If it's a personal repo, "foo" can be your initials, last name, or something similar.
  3. Name your stacks and packages. You can check out here for more info:
    http://www.ros.org/wiki/Naming
    You should try to be descriptive as to what the stack/package is, and also try not to clash with other existing stacks, in case you decide to make your code public at some point.
  4. Organize your directories. Your repository should contain the stacks, and the stacks contain the packages. As an example: our repo is called "ccny-ros-pkg". It has a "scan_tools" stack, which in turn contains a "canonical_scan_matcher" package. So I store it in:
    ~/ros/ccny-ros-pkg/scan_tools/canonical_scan_matcher
    Note that "~/ros" does not have to be your ROS installation directory. As the other answers pointed out, you usually install ROS binaries in "/opt/ros", but you can keep your development work in "~/ros", where you have write permissions.
  5. Prepend "~/ros/" to ROS_PACKAGE_PATH in your setup.sh file, located in your ros installation directory. For example, mine contains these lines:
    export ROS_PACKAGE_PATH=/opt/ros/diamondback/stacks
    export ROS_PACKAGE_PATH=~/ros:${ROS_PACKAGE_PATH}
  6. Apply version control. Usually, you would put you whole repository under version control, ie, foo-ros-pkg. If you are using git, you can simply do:
    cd ~/ros/foo-ros-pkg
    git init
    
    This will create a hidden ".git" folder inside "foo-ros-pkg". It will contain your local repository.

Hope this helps!
Ivan

edit flag offensive delete link more

Comments

@Ivan Dryanovski: Thanks a lot..
alfa_80 gravatar image alfa_80  ( 2011-12-09 07:56:28 -0600 )edit
3

answered 2011-03-03 05:41:22 -0600

Eric Perko gravatar image

I use git for most of my ROS work and have no problems with it.

Some tips:

  1. Don't keep your packages in /opt/ros... I like to keep my development code in a folder like ~/code/dev_stacks and then I prepend that path to ROS_PACKAGE_PATH in my .bashrc. See the Setup page on the CWRU-ROS-PKG wiki for directions on how I had students in our Mobile Robotics course checkout the cwru-ros-pkg.
  2. There is no need to change the directory name on your package to include the .git extension. Git URLS are the only place the .git extension to the repo name is actually used to my knowledge.
edit flag offensive delete link more

Comments

Pertaining #2. i think our repository has to be with extension .git? Can someone correct me..By the way, I intend to do version control only locally, not on github. Thanks
alfa_80 gravatar image alfa_80  ( 2011-03-03 05:58:00 -0600 )edit
I think it may just be bare repositories that need the .git extension. See http://tiredblogger.wordpress.com/2009/11/09/creating-local-git-repositories-yeah-its-that-simple and note that they create a bare repo with the .git extension. This bare repo would _not_ go on your ROS_PACKAGE_PATH.
Eric Perko gravatar image Eric Perko  ( 2011-03-03 06:01:12 -0600 )edit
Thanks a lot Eric :-)
alfa_80 gravatar image alfa_80  ( 2011-03-03 06:47:35 -0600 )edit
1

answered 2011-03-03 17:13:18 -0600

Willy Lambert gravatar image

updated 2011-03-03 17:13:44 -0600

Once everything is configured, you may also use rosinstall with git in creating a *.rosinstall file. If you publish it on the web http:/mysite/mystack.rosinstall user will be able to install the stack easily. Here is the orocos_toolchain_ros example :

orocos_toolchain_ros.rosinstall: - git: local-name: orocos_toolchain_ros uri: http://git.mech.kuleuven.be/robotics/orocos_toolchain_ros.git

rosinstall [path] http:/mysite/mystack.rosinstall

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2011-03-03 05:26:33 -0600

Seen: 2,295 times

Last updated: Mar 03 '11