0% found this document useful (0 votes)
10 views36 pages

Ros Workshop Itr

Uploaded by

Debojit Das
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)
10 views36 pages

Ros Workshop Itr

Uploaded by

Debojit Das
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/ 36

ROS

Workshop
ME 639 : Introduction to Robotics
What is ROS?

• ROS is an meta-operating system for robots. It is like the


brain and nervous system of a robot. It's open-source,
meaning anyone can use and modify it. ROS helps
different parts of a robot work together by providing
tools and services, much like how an operating system
(like Windows or Linux) helps a computer run programs.
When to use ROS?!

The robot contains many different


sensors and actuators. ROS will help you
create a distributed system for all those
components, instead of having one big
monolith code base that will be hard to
maintain and scale.
1. For Education Purposes: ROS helps
students see the full picture of
robotics applications.
2. For Research Purposes: Prevents
re-inventing the wheel.
3. For Fast Prototyping
Why ROS?

• free and open source robotics software


framework
• Message passing interface between
processes
• Operating system–like features.
• High-level programming language support
and tools.
• Availability of third-party libraries.
• Off-the-shelf algorithms.
• Ease in prototyping
• Ecosystem/community support.
• Extensive tools and simulators
ROS contains many open source implementations of common robotics functionality and algorithms. These
open source implementations are organized into "packages". Many packages are included as part of ROS
distributions, while others may be developed by individuals and distributed through code sharing sites such as
github. Some packages of note include:

Mapping and
Motion planning
localization

Navigation Perception

Coordinate frame
Simulation
representation
ROS Workspace
ROS Workspace
1. The first step in ROS development is the creation of the ROS
workspace, which is where ROS packages are kept. We can create
new packages, install existing packages, build and create new
executables.
2. A workspace is simply a set of directories in which a related set of
ROS code lives.
ROS Workspace

src folder build folder devel folder


src folder build folder devel folder

• The src folder is the • The catkin tool creates • All the executable
place where you can some build files and files results from
create, or clone, intermediate cache building the
new packages from CMake files inside the packages is stored
repositories. build folder. inside the devel
• These cache files help folder, which has
NOTE: ROS packages only prevent from rebuilding shell script files to
build and create an all the packages when add the current
executable when it is in the
src folder
running the catkin_make workspace to the
command. ROS workspace
path.
Here’s A typical workspace layout
Create a folder for your workspace ( give your folder a
Create name representable of your application )

So How to Create Create another folder inside the first name and give it
the name "src"
create a ROS
Workspace?!
Initialize the workspace using the command
Initialize catkin_init_workspce

Go back to the main folder and build your workspace


Go back using catkin_make

Add the workspace environment. i.e. you must set the


Add workspace path so that the packages inside the
workspace become accessible and visible.
$ mkdir ~/<workspace_name>/src

$ cd ~/<workspace_name>/src

$ catkin_init_workspace

$ cd ..

$ catkin_make

$ source ~/<workspace_name>/devel/setup.bash
ROS Filesystem
ROS filesystem

ROS packages are the main unit of


an ROS software framework.
A ROS package may contain
Metapackages: Packages: executables, ROS-dependent
library, configuration files, and so
on. ROS packages can be reused
and shared.
ROS filesystem

Package
Manifests:

Message (msg)
Metapackages: Packages:
types:

Service (srv)
types:
ROS filesystem

The manifests (package.xml) file will have all the


Package Manifests: details of the packages, including name,
description, license, and dependencies.

Message descriptions are stored in the msg folder in


a package. ROS messages are data structures for
Metapackages: Packages: Message (msg) sending data through ROS.
types: Message definitions are stored in a file with the .msg
extension.

Service descriptions are stored in the srv folder with


Service (srv) types: the .srv extension. The srv files define the request and
response data structure for service in ROS.
ROS Packages
ROS software is organized into
What is ROS packages, each of which contains
packages?! some combination of code, data, and
documentation.

The ROS package is where ROS nodes


are organized—libraries and so forth
How to create a ROS package?!

$ catkin_create_pkg ros_package_name package_dependencies

Note make sure you are at the source file when you creating your packages
So what is the purpose of these files?!

• has all the commands to build the ROS source


CMakeLists.txt: code inside the package and create the
executable.

• An XML file mainly contains the package


package.xml:
dependencies, information, ..etc.

src: • Contains the source code of ROS package.

include: • contains the package header files.


Package.xml

is package.xml. As discussed, this file has


information about the package and its
dependencies

You can edit this file and add


dependencies, package information, and
other information to the package
CMakeLists.txt

The find_package() finds the necessary


dependencies of this package.
If these packages are not available, we can’t
able to build this package.

The catkin_package() is a catkin-provide


CMake macro used for specifying
catkin-specific information to the build
system.
ROS Build System : CATKIN

• catkin is a build system for compiling ROS packages.


(http://wiki.ros.org/catkin).
• catkin is a custom build system made from the CMake build
system and Python scripting.
ROS Topics
• A topic may be introduced, and various publishers may take turns publishing to that
topic.
• Publishers and subscribers are anonymous. A publishers only knows it is publishing to
a topic, and a subscriber only knows it is subscribing to a topic. Nothing else.
• A topic has a message type. All publishers and subscribers on this topic must use the
message type associated with the topic.
•A node really isn't much more than an executable file within a
ROS package. ROS nodes use a ROS client library to
ROS Nodes communicate with other nodes. Nodes can publish or subscribe
to a Topic. Nodes can also provide or use a Service.
A node can be
A node is a ROS launched
program that independently of
uses ROS’s other nodes and
middleware for in any order
communications. among launches
of other nodes.

ROS Nodes
Many nodes can A node is useful
run on the same only if it can
computer, or communicate
nodes may be with other nodes
distributed and ultimately
across a network with sensors and
of computers. actuators.
• • ROS topics are Named buses in which ROS nodes
ROS Topics can send a message. A node can publish or subscribe
any number of topics.
ROS MASTER NODES PARAMETER MESSAGES
Computation LEVEL

Graph Level
The ROS Computation Graph is
the peer-to-peer network of the
ROS process that TOPICS SERVICES BAGS
processes data together.
The following are the basic
concepts of ROS CGL: Communication Tools
ROS Client Libraries
The ROS client libraries are a collection of
code with functions to implement ROS
concepts. We can simply include these library
functions in our code to make it a ROS node.

What are ROS The client library saves development time


Client because it provides the built-in functions to
make a ROS application.
libraries
Think of it as c++ libraries that you include
using the command #include<library_name.h>
at the beginning of your source code to use
c++ functions such cout and cin
ROS client library for C++. It is

1: Roscpp: widely used for developing ROS


applications because of its high
performance.

the ROS client library for Python


Advantages:
Main ROS 2: Rospy:
Saving development time.
ideal for quick prototyping

Client Library applications Disadvantage:


performance is weaker than with
roscpp

the ROS client library of the Lisp


language. It is mainly used in
3: Roslisp: motion planning libraries on ROS it
is not as popular as roscpp and
rospy.
ROS Messages
ROS Messages

• • A message is a simple data


structure, comprising typed
fields. Standard primitive types
(integer, floating point, Boolean,
etc.) are supported, as are arrays
of primitive types. Messages can
include arbitrarily nested
structures and arrays (much like C
structs).
• • The messages are basically
going through the topic.
Creating the Messages
Let’s see it in Action

You might also like