Ask Your Question

how to create a patch

asked 2011-09-05 02:35:21 -0500

jrcapriles gravatar image


I'm working with gazebo simulator and I developed some new stuff (sensors) that i would like to share, what is the normal procedure to do that?

To share my package, have I to send my entire gazebo package (with my modifications)? or, should I do something like:

diff -rupN original/ new/ > original.patch

And send only the patch-file?

I ask this because i want to try it in other PC before share it with the whole community.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-09-05 03:42:32 -0500

joq gravatar image

updated 2011-09-05 07:29:48 -0500

While @Lorenz makes a good point about creating new packages, there are sometimes good reasons to produce patches for an existing package.

The best solution is to check out a development version of the desired package, then use the diff tool for the relevant version control system (i.e. svn diff, hg diff, or git diff). That produces a patch that is easy for the maintainers to apply.

Using the gazebo_plugins package for an example, we first locate the development repository. You can look it up on the package wiki page, or use roslocate:

$ roslocate info gazebo_plugins
- svn:
    local-name: gazebo_plugins

Note that this is a package (roslocate type gazebo_plugins prints package). I recommend checking out the containing stack and not just one package. The stack is the ROS unit of installation, and packages may depend on other packages within the stack.

In this example the containing stack is simulator_gazebo:

$ roslocate info simulator_gazebo > ~/gazebo.rosinstall
$ rosinstall ~/ros ~/gazebo.rosinstall /opt/ros/electric/.rosinstall
$ source ~/ros/setup.bash
$ roscd gazebo_plugins

Test that the downloaded version works unmodified. Then, make your changes and test them.

To produce a patch:

$ roscd gazebo_plugins
$ svn diff > ~/my_gazebo_plugins.diff

If your patch fixes a bug or implements a generally useful extension to the package, open a defect or enhancement ticket for the containing stack, adding your patch as an attachment.

edit flag offensive delete link more


Hi joq, Thanks for your answer! It would be nice a detailed example, i used the diff tool but i'm not expert on it! The example would be really useful Thanks for your time!
jrcapriles gravatar image jrcapriles  ( 2011-09-05 04:11:35 -0500 )edit
Normally, you create patches to contribute bug-fixes or extensions back to the original authors of a package. In that case, the easiest way to get a patch is to use the corresponding functionality of your VCS. For instance, if you want a patch for your changes in package foo, do: roscd foo; svn diff
Lorenz gravatar image Lorenz  ( 2011-09-05 04:21:42 -0500 )edit

answered 2011-09-05 03:27:12 -0500

Lorenz gravatar image

Normally, people don't modify existing packages but create their own packages that extend or use existing software.

In your case, it might be possible to create gazebo plugins similar to that ones that can be found in the ros packages gazebo_plugins and pr2_gazebo_plugins. Other users then just need to download your package and make it available for ROS by setting the ROS_PACKAGE_PATH appropriately.

edit flag offensive delete link more


tfoote gravatar image tfoote  ( 2011-09-05 03:41:40 -0500 )edit
Thanks for your answer Lorenz, Do you know if there is any tutorial to create the gazebo_plugins?? Should I create a new package similar to the gazebo_plugin (with my work)? how can i create it? or can I just add my code to that package (with the proper Cmake.., patch, manifest) Thanks!
jrcapriles gravatar image jrcapriles  ( 2011-09-05 04:04:26 -0500 )edit
I think you should create a new package. Tutorial here: Have a look at gazebo_plugin's dependencies and CMakeLists.txt to find out appropriate parameters. Also, you need to set a gazebo export tag in manifest.xml, as in gazebo_plugin's manifest.
Lorenz gravatar image Lorenz  ( 2011-09-05 04:13:34 -0500 )edit
I am also working on the package creation. i want to add GazeboRosSonar and GazeboRosIr plugins to gazebo_plugins. and also i have created SonarSensor and modified IRSensor, MultiRayShape(which is present in physics folder of gazebo) and gz, how i would add that to the package.
SAK gravatar image SAK  ( 2011-09-05 22:22:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-09-05 02:35:21 -0500

Seen: 478 times

Last updated: Sep 05 '11