Creating a ROS Package by Hand

From Lofaro Lab Wiki
Jump to: navigation, search

Close all opened terminals.

1) In a terminal window, navigate to your catkin workspace:

cd ~/catkin_ws

2) Source the setup file:

source ./deevel/setup.bash

3) Create a folder called foobar in the src folder, and navigate into it:

mkdir -p src/foobar
cd src/foobar

4) Create the file packages.xml:

gedit package.xml

In the editor paste the following:

  This package provides foo capability.
  <maintainer email="">PR-foobar</maintainer>




Save the file and close the editor.

5) To check that the package.xml was sucessful, have ROS find it:

rospack find foobar

Something like "/home/gmustudent/catkin_ws/src/foobar" will print

6) Create the file CMakeLists.txt:

gedit CMakeLists.txt

In the editor paste the following:

cmake_minimum_required(VERSION 2.8.3)
find_package(catkin REQUIRED roscpp std_msgs)

Save the file and close the editor.

7) To check that both files are in the foobar folder:


This should display "CMakeLists.txt Package.xml"

These files don't do anything but they are the minimum needed for creating a ROS Package.