Note: This tutorial assumes that you have completed the previous tutorials: Catkin Overlays and Workspace Chaining. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Developing rosbuild packages on top of groovy
Description: Developing rosbuild packages on top of catkin workspaces.Tutorial Level: BEGINNER
Next Tutorial: Converting rosbuild packages to catkin
Contents
rosbuild packages
Previous versions of ROS have been delivered with a build system called rosbuild, with the ubiquitous command `rosmake`. While we think that catkin provides the superior approach to building packages, rosbuild will be supported for some more time, given the huge amount of packages out there built with rosbuild.
rosbuild packages are also called dry packages, because the introduction of catkin to existing ros packages starts with low-level (core) packages and slowly moves up to higher-level packages, like a rising tide.
It is not possible to migrate a rosbuild package to catkin before all the ROS packages it depends on have equally been migrated to catkin.
Note: This tutorial is for using rosbuild with rosws, which requires you to explicitly add every rosbuild package you want ROS to be aware of. Be sure you have read the rosws documentation and understand its functionality. Another option is to simply set your rosbuild package path using the "export ROS_PACKAGE_PATH=" environmental variable.
rosbuild workspace
Prerequisites
For this tutorial you need to read the documentation and install the rosws tool. Make sure to use a version greater than 0.6.22, else the ROS_PACKAGE_PATH will be missing underlying catkin workspaces. Call rosws regenerate after updating rosws.
rosbuild workspace with groovy and later
$ mkdir ~/rosbuild_ws $ cd ~/rosbuild_ws $ rosws init . /opt/ros/groovy
The rosws init command creates the following file structure in rosbuild_ws:
rosbuild_ws --ROSBUILD WORKSPACE setup.sh setup.bash setup.zsh .rosinstall
You can use the setup.sh file to work with this environment. This will also automatically use the catkin_ws workspace that we used for the rosws init command.
rosbuild workspace on top of catkin workspace
In previous tutorials we have set up a catkin workspace that looks like this:
catkin_ws/ --WORKSPACE src/ ... build/ devel/ --DEVELSPACE setup.sh setup.bash setup.zsh .rosinstall
Instead of creating a rosbuild workspace that refers to your installed ROS distribution (e.g. /opt/ros/groovy), we can also refer to this catkin workspace.
When we create a workspace for rosbuild in this tutorial, we want to have it separate from the catkin workspace in order not to get confused.
So for clarity we will set up a rosbuild workspace apart from the catkin workspace:
$ mkdir ~/rosbuild_ws $ cd ~/rosbuild_ws $ rosws init . ~/catkin_ws/devel
This should give you this file structure:
catkin_ws/ --CATKIN WORKSPACE ... rosbuild_ws --ROSBUILD WORKSPACE setup.sh setup.bash setup.zsh .rosinstall
You can source the generated rosbuild_ws/setup.sh files to work with both the rosbuild and the catkin workspace.
rosbuild workspace on top of catkin installspace
If you prefer to work with the install space of a catkin workspace, initialize your rosbuild workspace this way:
$ rosws init ~/rosbuild_ws ~/catkin_ws/install
Else nothing changes. If you have a running rosbuild workspace and want to change what it refers to, you will have to change your .rosinstall file, specifically that line:
- setup-file: {local-name: /home/<user>/catkin_ws/devel/setup.sh}
Just change the path in this line of your .rosinstall file to point to the setup.sh file you want to use. Note it is not recommended to switch to another ROS distribution, but you could well change from
/home/<user>/catkin_ws/devel/setup.sh
to
/home/<user>/catkin_ws/install/setup.sh
Once your rosbuild workspace is set up with a - setup-file: {...}-entry for your catkin workspaces then any rosbuild packages in it will be able to build on top of the wet packages in those catkin workspaces.
If you are using catkin packages from debian packages you can just overlay on /opt/ros/groovy and everything should work.
Getting rosbuild Package Sources
An example on pulling the source for gmapping into the rosbuild workspace
$ cd ~/rosbuild_ws $ wstool set gmapping --git https://github.com/ros-perception/slam_gmapping.git $ rosws update gmapping $ source setup.bash
To verify your overlay chain:
$ echo $ROS_PACKAGE_PATH /home/<user>/rosbuild_ws/gmapping:/home/<user>/catkin_ws/src:/opt/ros/groovy/share:/opt/ros/groovy/stacks
To build:
# in rosbuild_ws $ rosmake gmapping
To run:
$ cd ~/rosbuild_ws $ source setup.bash $ rosrun ...