0% found this document useful (0 votes)
112 views59 pages

ROS Course Day 3 PDF

The document provides an overview of key concepts in the Robot Operating System (ROS), including the ROS build system, file system structure, computational graph structure, and common command-line tools. It discusses how ROS packages are organized, how to create a ROS workspace and package, and how nodes communicate via topics, messages, and services. The ROS computational model involving publishers, subscribers, and the ROS master is explained. Finally, common ROS commands like roscore, rostopic, rosnode, and rosparam are briefly introduced.

Uploaded by

aayushi gautam
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)
112 views59 pages

ROS Course Day 3 PDF

The document provides an overview of key concepts in the Robot Operating System (ROS), including the ROS build system, file system structure, computational graph structure, and common command-line tools. It discusses how ROS packages are organized, how to create a ROS workspace and package, and how nodes communicate via topics, messages, and services. The ROS computational model involving publishers, subscribers, and the ROS master is explained. Finally, common ROS commands like roscore, rostopic, rosnode, and rosparam are briefly introduced.

Uploaded by

aayushi gautam
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/ 59

ROS For Absolute Beginners

(Robot Operating System)

Lentin Joseph
http://robocademy.com Founder/Instructor of Robocademy
Founder of Qbotics Labs
Day 3

ROS Concepts

http://robocademy.com
Agenda
• What is ROS Build System?

• Setting a ROS workspace

• ROS File System Level

• ROS Computation Graph Level

http://robocademy.com
Agenda

• ROS Community Level

• ROS Command Tools

• Learning ROS concepts using Turtlesim Demo

http://robocademy.com
Build System in ROS
• What is a build system in ROS?

• A build system 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.

http://robocademy.com
Which ROS build system are we
using now ??
• What is catkin build system ?
• http://wiki.ros.org/catkin/conceptual_overview
• A CMake(Cross Platform Make) based +
Python scripted system
• Helps to build source code in cross platform
• Better distribution of package
• Better than rosbuild build system used till
ROS- groovy

http://robocademy.com
Task 1
• Install Terminal tool called Terminator
• $ sudo apt-get install terminator

http://robocademy.com
How to create a workspace for
ROS?
• What is a workspace ?
• How to create a catkin based workspace ?
• http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguring
ROSEnvironment

• $ mkdir -p ~/ros_catkin_ws/src

• $ cd ~/ros_catkin_ws/src

• $ catkin_init_workspace

http://robocademy.com
How to create a workspace for
ROS?
• $ cd ~/ros_catkin_ws/

• $ catkin_make

• $ echo "source
~/ros_catkin_ws/devel/setup.bash"
>> ~/.bashrc

http://robocademy.com
How to create a workspace in
ROS?

http://robocademy.com
Creating a ROS Workspace: Demo

http://robocademy.com
ROS Levels of Concepts

• ROS File System Level

• ROS Computational Level

• ROS Community Level

http://robocademy.com
ROS File System

http://robocademy.com
ROS File System
• Packages
• Metapackages
• Package Manifest
• Repositories
• Message (msg) types
• Service (srv) types

http://robocademy.com
What is a ROS Package ?
• http://wiki.ros.org/Packages

• Software in ROS is organized in packages.

• A package might contain ROS nodes, a ROS-


independent library, a dataset, configuration files, a third-
party piece of software, or anything else that logically
constitutes a useful module.

• The goal of these packages it to provide this useful


functionality in an easy-to-consume manner so that
software can be easily reused.
http://robocademy.com
How to create a hello_world ROS
package inside ROS workspace?
• Goto src folder of ros_catkin_ws
• $ cd ~/ros_catkin_ws/src

• $ catkin_create_pkg hello_world
std_msgs rospy roscpp

http://robocademy.com
Inside hello_world package

http://robocademy.com
The CMakeFile.txt

http://robocademy.com
The package Manifest

http://robocademy.com
How to build hello_world package
• Switch to ROS workspace
– $ cd ~/ros_catkin_ws
• Build the packages inside workspace
– $ catkin_make
– $ catkin_make install
• Check package is installed
– $ roscd hello_world

http://robocademy.com
How to create/build a hello_world
ROS package?
• Creating and Building a Package Demo

http://robocademy.com
Structure of ROS Package
CMakeLists.txt
package.xml talker.py
talker.cpp
tistener.py
listener.cpp

config include scripts src

launch msg srv action

http://robocademy.com
ROS Computation Graph Level

http://robocademy.com
ROS Computation Graph Level

• Nodes

• Master

• Parameter Server

http://robocademy.com
ROS Computation Graph Level
• Message

• Topics

• Services

• Bags

http://robocademy.com
ROS Nodes

http://robocademy.com
What is a ROS Node ??
• Nodes: Nodes are processes that perform
computation.
• A robot control system usually comprises many nodes.
For example, one node controls a laser range-finder,
one node controls the wheel motors, one node
performs localization, one node performs path
planning, one Node provides a graphical view of the
system, and so on.

• A ROS node is creating with the help of ROS client


libraries, such as roscpp or rospy.

http://robocademy.com
ROS Topics
• Topics are named buses over
which nodes exchange messages.

Topic : /talker
Message : std_msgs/String

Publish data
Topic : /talker listener node
talker node
Subscribe data
Message : std_msgs/String
ros node 1 ros node 2

http://robocademy.com
ROS Message
• Nodes communicate with each other by
publishing messages through topics.
• 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.

http://robocademy.com
ROS Message
• Example :
• std_msgs , eg : std_msgs/String
• sensor_msgs , eg: sensor_msgs/Image
• geometry_msgs ,eg:
geometry_msgs/Twist
• Custom Message definitions stored in
msg folder inside a ROS package

http://robocademy.com
ROS Master
• The ROS Master provides naming and registration services
to the rest of the nodes in the ROS system.

• It tracks publishers and subscribers to topics as well


as services.

• The role of the Master is to enable individual ROS nodes to


locate one another. Once these nodes have located each
other they communicate with each other peer-to-peer.
• The Master also provides the Parameter Server.

• The Master is most commonly run using


the roscore command, which loads the ROS Master along
with other essential components.

http://robocademy.com
How ROS inter process
communication works ?
Publish String Message

Topic : /talker

Message : std_msgs/String ROS Master

listener
talker
node
node

http://robocademy.com
How ROS inter process
communication works ?
Subscribe String Message
Publish String Message
Topic : /talker
Topic : /talker
Message : std_msgs/String
Message : std_msgs/String ROS Master

listener
talker
node
node

http://robocademy.com
How ROS inter process
communication works ?
Publish String Message Subscribe String Message

Topic : /talker ROS Master Topic : /talker

Message : std_msgs/String Message : std_msgs/String

listener
talker
node
node
/talker

“Hello World”

http://robocademy.com
Block Diagram of ROS Master
• Naming and Registration of Nodes
• Parameter Server
– Stores various parameters of nodes in a
centralized location

Naming and Registration


Parameter Server
Services

http://robocademy.com
ROS Community Level

• Distributions: Distribution are collection of


versioned stacks that you can install
• Repositories:
• The ROS Wiki
• Mailing List
• ROS Answers
• Blog

http://robocademy.com
ROS Command tools

http://robocademy.com
Command : roscore
• roscore is a collection of nodes and programs
that are pre-requisites of a ROS-based
system.

• You must have a roscore running in order


for ROS nodes to communicate. It is
launched using the roscore command.

• roscore = rosmaster + parameter server +


rosout logging node

http://robocademy.com
Try roscore in your terminal

http://robocademy.com
Command : rostopic

http://robocademy.com
Command : rosnode

http://robocademy.com
Command : rosparam

http://robocademy.com
Command : rosrun

http://robocademy.com
roscpp tutorials: talker & listener

http://robocademy.com
roscpp tutorials: talker & listener
• $ roscore

[Publisher]
• $ rosrun roscpp_tutorials talker

[Subscriber]
• $ rosrun roscpp_tutorials listener

http://robocademy.com
roscpp tutorials: talker & listener

http://robocademy.com
Playing with ROS command tools

http://robocademy.com
Turtlesim Demo

http://robocademy.com
Learn ROS using Turtlesim
• http://wiki.ros.org/turtlesim

http://robocademy.com
Launching turtlesim

• $ roscore [In first terminal]

• $ rosrun turtlesim turtlesim_node [In


second terminal]

http://robocademy.com
Launching turtlesim

http://robocademy.com
Moving turtle

• $ rosrun turtlesim turtle_teleop_key

http://robocademy.com
Moving turtle

http://robocademy.com
Inspecting ROS Topic

http://robocademy.com
Inspecting ROS Parameter

http://robocademy.com
Communication graph

http://robocademy.com
Turtlesim Demo: Draw Square

• $ roscore [In first terminal]

• $ rosrun turtlesim turtlesim_node [In


second terminal]

• rosrun turtlesim draw_square

http://robocademy.com
Turtlesim Demo: Draw Square

http://robocademy.com
Conclusion
• Discussed ROS Build system, ROS File
system level, computation level and
Community level

• Discussed ROS commands tools

• Worked with ROS concepts using


Turtlesim demo
http://robocademy.com

You might also like