Skip to content

Migrating a repository to ROS2 (Humble)

Effie Daum edited this page Feb 4, 2024 · 1 revision

Before the migration

Before starting the migration of a repository to ROS 2, if you have the repository cloned on your computer, make sure that the version you have does not contain any local change and is up to date. If you don't have the repository cloned on your computer already, you can go ahead and clone it and jump directly to the next section of this tutorial.

It is possible to see if your local copy of the repository has been changed by running the following command in a terminal at the root of the repository:

git status

If you have no local change, the output should look something like this:

If you do have local changes, either push them to Github or clear them using the following command before proceeding:
git reset --hard

Finally, make sure that you are on the master branch and pull the latest changes using the following commands:

git checkout master
git pull

Migration

Before starting the migration of your repository, you need to create a new branch using the following command:

git checkout -b humble

You are now ready to migrate your repository to ROS 2! You can have a look at libpointmatcher_ros, norlab_icp_mapper_ros and marmotte_mapping to see how the migration of these pacakges was done.

Once you are done migrating your repository, add the files that need to be committed and commit them using the following commands:

git add <first_file_to_add>
git add <second_file_to_add>
...
git add <last_file_to_add>
git commit -m "Migrated to Humble."

You can then push your newly created branch to Github using the following command:

git push -u origin humble

After the migration

Once everything is pushed, using a web browser, go to your repository page on github.com. First, you will need to rename the master branch to melodic. To do so, go to the "Settings" tab of your repository (top right of the page)

and select branches in the left menu

. Then, click on the "Rename branch" button (to the right of `master`)

and change the name of the branch to `melodic`. Now, if you go back to the "Code" tab (top left of the page)

, you should receive a notification that looks like this:

. Follow the instructions to make sure the renaming of the branch is also done on your local version of the repository. Finally, you will need to set the `humble` branch as default. To do this, go back to the "Branches" settings, click on the "Switch to another branch" button (to the right of `melodic`)

and select the `humble` branch. You are now done with the migration of your package to ROS 2, good job!

How to migrate nodes

Here are some resources that give an overview of some things to consider while migrating a node :

Here are some nodes that were migrated successfully from melodic (ROS1) to humble (ROS2):

Clone this wiki locally