Documente Academic
Documente Profesional
Documente Cultură
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?
http://robocademy.com
Agenda
http://robocademy.com
Build System in ROS
• What is a build system in ROS?
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
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
• $ 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
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.
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.
http://robocademy.com
How ROS inter process
communication works ?
Publish String Message
Topic : /talker
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
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
http://robocademy.com
ROS Community Level
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.
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
http://robocademy.com
Launching turtlesim
http://robocademy.com
Moving turtle
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
http://robocademy.com
Turtlesim Demo: Draw Square
http://robocademy.com
Conclusion
• Discussed ROS Build system, ROS File
system level, computation level and
Community level