Package Setup

What is a catkin Package?

For a package to be considered a catkin package it must meet a few requirements:

  • The package must contain a catkin compliant package.xml file.

    • That package.xml file provides meta information about the package.

  • The package must contain a CMakeLists.txt which uses catkin.

  • Each package must have its own folder

    • This means no nested packages nor multiple packages sharing the same directory.

The simplest possible package might have a structure which looks like this:

my_package/
  CMakeLists.txt
  package.xml

Creating a Package

First you must create a catkin workspace to put the package in. Once you have a workspace you can create the package.

cd ~/catkin_ws/src
catkin_create_pkg <package_name> [depend1] [depend2] [depend3]

For example:

catkin_create_pkg package_name std_msgs roscpp

Building a Package

Build entire workspace:

cd ~/catkin_ws
catkin_build

Build single package:

cd ~/catkin_ws
catkin_build <package_name>

Last updated