ROS uses CMake, a powerful cross-platform build tool, at its core. Rosbuild and Catkin are ROS scripts for managing the CMake-based build system for ROS. Catkin is the newer, preferred option.
ROS packages that are build using Rosbuild do not work in a Catkin workspace thus it becomes necessary to migrate from Rosbuild to Catkin. The ROS Wiki provides a comprehensive guide for migration, however manually performing these steps can be time consuming and frustrating. This simple step-by-step guide is designed to help you to quickly get started with the migration process.
Prepare a catkin workspace
ROS provides a tool for managing SCM repositories (such as git, mercurial or subversion). One limitation of this tool is that you cannot add non-versioned elements into the workspace. To install wstool, simply run
sudo apt-get install python-wstool.
Create a catkin workspace
Assuming you have an SVN repository with a workspace named mybot, run the following commands:
wstool init src
This will create a Catkin workspace with a src directory containing a CMakeLists.txt file, and build and devel directories.
Add the packages to the workspace
To download the packages from SVN proceed as follows:
wstool set -t src catkin --svn https://svn.yourdomain.com/svnroot/mybot
wstool update -t src
This will download and install packages from SVN to the target -t src directory within your Catkin workspace.
Let ROS know about this workspace
Simply source your workspace:
source setup.bash --extend
Migrate packages to catkin
Install the catkinize script
The catkinize script from ros-infrastructure semi-automates the creation of a new CMakeLists.txt file, and its associated package.xml file. Installing the script is very simple:
git clone https://github.com/ros-infrastructure/catkinize.git
sudo python setup.py install
Run the catkinize script in each package
A rosbuild package will contain CMakeLists.txt, Makefile, and manifest.xml files. The catkinize script creates a new CMakeList.txt file and a package.xml file. In each package, run:
catkinize my_package 0.0.0
Compile the catkinized code
A catkin workspace is compiled from the top-level directory. Simply run:
Once each package has been catkinized, the CMakeLists.txt and package.xml files should be updated accordingly.
One thought on “Quickly migrating from Rosbuild to Catkin”