0% found this document useful (0 votes)
48 views

Workspace Robotic Operating System (ROS)

The document discusses the ROS build system CATKIN. It describes how to create a CATKIN workspace, add packages to the workspace, and build packages. The key points are: - CATKIN is the official build system of ROS based on CMake and Python scripts. It creates a workspace to build multiple ROS packages. - To initialize a CATKIN workspace, the catkin_init_workspace command is used within a src directory under the workspace folder. - Packages are added to the workspace using the catkin_create_pkg command. The workspace can then be built using catkin_make which compiles all packages. - The workspace structure separates code into a src directory containing multiple packages

Uploaded by

Pako Dominguez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Workspace Robotic Operating System (ROS)

The document discusses the ROS build system CATKIN. It describes how to create a CATKIN workspace, add packages to the workspace, and build packages. The key points are: - CATKIN is the official build system of ROS based on CMake and Python scripts. It creates a workspace to build multiple ROS packages. - To initialize a CATKIN workspace, the catkin_init_workspace command is used within a src directory under the workspace folder. - Packages are added to the workspace using the catkin_create_pkg command. The workspace can then be built using catkin_make which compiles all packages. - The workspace structure separates code into a src directory containing multiple packages

Uploaded by

Pako Dominguez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Departamento de Ingeniería

de Sistemas y Automática

Workspace
Robotic Operating System (ROS)
CATKIN
Official build system of ROS based on Cmake and
Python scripts. It creates a workspace in which a
number of packages can be built.

It is in charge of generating executables from source


code, manage dependences, organize and make
packages accessible.
Departamento de Ingeniería
de Sistemas y Automática

Grado en Ingeniería Electrónica, Robótica y Mecatrónica


Robótica y Automatización 2
Create CATKIN workspace
$ mkdir –p ~/catkin_ws/src Create the /src directory
$ cd ~/catkin_ws/src
$ catkin_init_workspace Initialize it and creates a CMakeLists file

$ cd ~/catkin_ws
Build it. Result: a workspace empty and ready to
$ catkin_make
work with.
$ ls
Departamento de Ingeniería
de Sistemas y Automática

$ echo "source ~/catkin_ws/devel/setup.bash" >>


~/.bashrc
$ source ~/.bashrc Add system variables to bashrc

Grado en Ingeniería Electrónica, Robótica y Mecatrónica


Robótica y Automatización 3
CATKIN workspace structure
[viki@notrix ../source/ros/catkin_ws]$ tree -L 3
.
├── build
│   ···
├── devel
│   ···
└──src
   ├── package 1
   │   ├── include
   │   ├── src
   │   ├── ···
   │   ├── CMakeLists.txt
   │   └── package.xml
Departamento de Ingeniería

   ├── package 2
de Sistemas y Automática

   │   ├── include


   │   ├── src
   │   ├── ···
   │   ├── CATKIN_IGNORE
   │   └── README.md
   ├── ···
   └── package n
      ├── include
      ├── src
      ├── ···
      ├── CMakeLists.txt
      └── package.xml
4
Creating a new package

catkin_create_pkg command
$ catkin_create_pkg <package_name> [depend 1] … [depend n]

Example of creating a package called test with


standard dependencies:
$ cd ~/catkin_ws/src
Departamento de Ingeniería

$ catkin_create_pkg test std_msgs roscpp


de Sistemas y Automática

Grado en Ingeniería Electrónica, Robótica y Mecatrónica


Robótica y Automatización 5
Building (compiling) package
$ cd ~/catkin_ws Actually we build all the
$ catkin_make packages included in the
workspace
Departamento de Ingeniería
de Sistemas y Automática

The package is
ready but
empty!!

Grado en Ingeniería Electrónica, Robótica y Mecatrónica


Robótica y Automatización 6
Implementing a ROS node
Let’s implement our first node in C++.

Modify the CMakeList.txt at /src/test/ to


include a reference to a .cpp file we are going to
implement. This tells the ROS system we want to
have a new executable.

At the end of CMakeList.txt add the following:


Departamento de Ingeniería
de Sistemas y Automática

Grado en Ingeniería Electrónica, Robótica y Mecatrónica


Robótica y Automatización 7
Implementing a ROS node

And rebuild the package:


$ cd ~/catkin_ws
$ catkin_make
Departamento de Ingeniería
de Sistemas y Automática

You will get an error since


the file direction.cpp is
not created yet!

Grado en Ingeniería Electrónica, Robótica y Mecatrónica


Robótica y Automatización 8
Departamento de Ingeniería
de Sistemas y Automática

Workspace
Robotic Operating System (ROS)

You might also like