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

Lecture - 3 - Robotics - Robot - Programming - Introdution - To - ROS (Module - 2) - Part - 2

Uploaded by

adamsmith94666
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)
5 views

Lecture - 3 - Robotics - Robot - Programming - Introdution - To - ROS (Module - 2) - Part - 2

Uploaded by

adamsmith94666
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

MODULE:2

INTRODUCTION TO ROS(PART_2)
CREDIT HOURS:5 HOURS

Dr. Abhishek Rudra Pal


Assistant Professor (Senior Grade-1)
SMEC
Vellore Institute of Technology - Chennai Campus
Email: [email protected]
Mobile No: +91-9043534478;+91-9051728314(Whatsapp)
catkin Build System
• catkin is the official build system of ROS and the successor to the original ROS build system called rosbuild.
• catkin is responsible for generating ‘targets’ from raw source code that can be used by an end user.
• These targets may be in the form of libraries, executable programs, generated scripts, exported interfaces
(e.g. C++ header files) or anything else that is not static code.
• In ROS terminology, source code is organized into ‘packages’ where each package typically consists of one or
more targets when built.
• So, to check if catkin is installed or not, just type catkin on your terminal and press the Tab key double time.
You should be able to see this.

18-01-2024 2
Understanding catkin Workspace

As you can see in the above diagram, a typical catkin


workspace contains up to four different spaces (source space,
build space, development space and install space) where each
space serves a different role in the software development
process.
18-01-2024 3
Source space:
• The source space contains the source code of catkin packages.
• This is where you can extract/checkout/clone source code for the packages you
want to build. Each folder within the source space contains one or more catkin
packages and each package has its set of ROS Computational Graph
components**.
• The root of the source space contains a symbolic link to catkin’s boiler-plate
‘toplevel’ CMakeLists.txt file. This file is invoked by CMake during the configuration
of the catkin projects in the workspace. It can be created by
calling catkin_init_workspace in the source space directory.

18-01-2024 4
Build space,Development space, Install
space :
• The build space is where CMake is invoked to build the catkin packages in the
source space. CMake and catkin keep their cache information and other
intermediate files here.
• The development space (or devel space) is where built targets are placed prior to
being installed. The way targets are organized in the devel space is the same as
their layout when they are installed. This provides a useful testing and
development environment which does not require invoking the installation step.
• once the targets are built, they can be installed into the install space by invoking
the install target, usually with make install. The install space does not have to be
contained within the workspace.

18-01-2024 5
Creating and building our ROS Package
• Essentially, ROS packages are catkin packages which means that they should follow a particular
directory structure and contain a couple of files that identify them as a ROS package and help us
build the code in the packages.

• ROS packages reside in directories called catkin workspaces and therefore, we would have to
create and initialize a catkin workspace first.

• Note: catkin packages can be built as a standalone project but catkin also provides the concept
of workspaces, where you can build multiple, interdependent packages together all at once.
• $mkdir catkin_ws //create a workspace called 'catkin_ws'
$mkdir catkin_ws/src //create a source folder inside the workspace
$cd catkin_ws/ //move inside the catkin workspace
• $catkin_make //compile the workspace 18-01-2024 6
Create our new ROS Package

• To create a new ROS package, we use the command catkin_create_pkg followed by


the name of the package and then followed by the package dependencies —
std_msgs, roscpp and rospy.
• std_msgs indicates that we will be using standard message types like int 8, int 64,
string or float
• roscpp indicates usage of C++ code
• rospy indicates usage of Python code

18-01-2024 7
Create our new ROS Package

• Once we execute the catkin_create_package command, a skeleton ROS package


will be created for us.
• We will then find a new package called ros_package inside our source folder and a
bunch of other files (ex: CMakeLists.txt, package.xml, etc.) inside our package as
shown above.
• CMakeLists.txt -This file contains information about how to build our ROS package
• package.xml -This file contains meta information about our package like the
description, version, dependencies, executables, etc.

18-01-2024 8
Build the workspace with the new empty packagen
and Make the workspace visible to the file system
• To build the workspace with the new package, we would have to go to the root of
the workspace and run the catkin_make command.
• To make the workspace and its packages visible to the file system so that we can
access these packages from anywhere, we would have to run the following
command:
• $source devel/setup.bash

18-01-2024 9

You might also like