(!) 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.

Creating a workspace for catkin

Description: This tutorial covers how to setup a catkin workspace in which one or more catkin packages can be built.

Keywords: catkin workspace

Tutorial Level: BEGINNER

Next Tutorial: Creating catkin packages


  1. Prerequisites


This tutorial assumes that you have installed catkin and sourced your environment. If you installed catkin via apt-get for ROS Inidgo, your command would look like this:

$ source /opt/ros/indigo/setup.bash

Let's create a catkin workspace:

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace

Even though the workspace is empty (there are no packages in the 'src' folder, just a single CMakeLists.txt link) you can still "build" the workspace:

$ cd ~/catkin_ws/
$ catkin_make

The catkin_make command is a convenience tool for working with catkin workspaces. If you look in your current directory you should now have a 'build' and 'devel' folder. Inside the 'devel' folder you can see that there are now several setup.*sh files. Sourcing any of these files will overlay this workspace on top of your environment. To understand more about this see the general catkin documentation: catkin. Before continuing source your new setup.*sh file:

$ source devel/setup.bash

To make sure your workspace is properly overlayed by the setup script, make sure ROS_PACKAGE_PATH environment variable includes the directory you're in.


Next you should go ahead and learn how to use the workspace.

If you are following the ROS tutorials series instead of the catkin tutorials, please continue with Creating a ROS Package.

Wiki: catkin/Tutorials/create_a_workspace (last edited 2015-05-20 22:07:47 by DirkThomas)