Professional Documents
Culture Documents
ROBOTICS
(SESSION-1)
MUHAMMAD ABDUL JALIL
Session Outline
www.ros.org
PART 1 – INTRODUCTION TO ROS
What is ROS?
Robot Operating System (ROS) is a framework for writing robot software.
It is a collection of tools, libraries, and conventions that aim to simplify the task of creating complex
and robust robot behavior across a wide variety of robotic platforms.
Also known as Meta-operating System
Meta-operating system that runs on the existing operating system (i.e windows, Linux, macOS)
PART 1 – INTRODUCTION TO ROS
What is ROS?
ROS Components
PART 1 – INTRODUCTION TO ROS
What is ROS?
ROS Terminology
Nodes
Topics and Messages
Services
Actions
ROS Master
Parameters
Packages, stacks, repository
Launch files
PART 1 – INTRODUCTION TO ROS
Nodes
Single-purposed executable programs
e.g. sensor driver(s), actuator driver(s), mapper, planner, UI, etc.
Individually compiled, executed, and managed
Nodes are written using a ROS client library
roscpp – C++ client library
rospy – python client library
Nodes can publish or subscribe to a Topic
Nodes can also provide or use a Service
PART 1 – INTRODUCTION TO ROS
Topic
A topic is a name for a stream of messages with a defined type
•e.g., data from a laser range-finder might be sent on a topic called scan, with a
message type of LaserScan
Nodes communicate with each other by publishing messages to topics
Publish/Subscribe model: 1-to-N broadcasting
PART 1 – INTRODUCTION TO ROS
Message
Strictly-typed data structures for inter-node communication
For example, geometry_msgs/Twist is used to express velocity commands:
PART 1 – INTRODUCTION TO ROS
Services
Synchronous inter-node transactions / RPC
Service/Client model: 1-to-1 request-response
Service roles:
carry out remote computation
trigger functionality / behavior
Example:
map_server/static_map – retrieves the current grid map used by the robot for
navigation
PART 1 – INTRODUCTION TO ROS
Services
PART 1 – INTRODUCTION TO ROS
Action
Communication on action is used when a
requested goal takes a long time to be
completed, therefore progress feedback is
necessary.
PART 1 – INTRODUCTION TO ROS
ROS Master
Provides connection information to nodes so that they can transmit messages to each
other
Every node connects to a master at startup to register details of the message streams
they publish, and the streams to which that they to subscribe
When a new node appears, the master provides it with the information that it needs to
form a direct peer-to-peer connection with other nodes publishing and subscribing to
the same message topics
PART 1 – INTRODUCTION TO ROS
ROS Master
PART 1 – INTRODUCTION TO ROS
ROS Master
PART 1 – INTRODUCTION TO ROS
ROS Master
PART 1 – INTRODUCTION TO ROS
Why ROS?
A Distributed, Modular Design
Package management
API
A Vibrant Community
Permissive Licensing
A Collaborative Environment
PART 1 – INTRODUCTION TO ROS
How ROS work?
ROS Topology
ROS Ma ste r
Ma ssa g e s
Sin g le C o m p u te r
PART 1 – INTRODUCTION TO ROS
How ROS work?
ROS Topology
ROS Ma ste r
Ro b o t C o m p u t e r C o m p u t e r / La p t o p
PART 1 – INTRODUCTION TO ROS
How ROS work?
ROS Topology
ROS Ma ste r
Ma ssa g e s
Ro b o t C o m p u te r C o m p u te r
PART 1 – INTRODUCTION TO ROS
How ROS work?
ROS Topology
ROS Ma ste r
Ma ssa g e s
Ro b o t C o m p u te r
PART 1 – CONCLUSION
Ironman.py
“Tony stark”
captain.py
“Steve hulk.py
Rogers” “Bruce
Banner”
Ironman.py
a n” “Tony stark”
“sc
c a n”
“s
captain.py
“Steve hulk.py
Rogers” “Bruce
Banner”
Ironman.py
“Tony stark”
“sm
ash
”
captain.py
“Steve “sm
ash hulk.py
Rogers” ” “Bruce
Banner”
Ironman.py
“Tony stark”
captain.py
“Steve hulk.py
Rogers” “Bruce
Banner”
Ironman.py ROS node
“Tony stark”
captain.py
“Steve hulk.py
Rogers” “Bruce
Banner”
Operating System
ROS master
ROS
PART 2 – SETTING UP
ROS ENVIRONMENT
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Ubuntu Installation
◦ Standalone / primary OS on laptop / PC
◦ Dual boot with Windows or MAC OS
RO S
In st a lla tio n
◦ Using Virtual Machine (Virtualbox, etc)
RO S
Enviro n m e nt
Se tup Dislike ubuntu??? Don’t worry… there are plenty of OS instead of UBUNTU that can
be used…..
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Ubuntu Installation Guides:
◦ Standalone / primary OS on laptop / PC
https://ubuntu.com/tutorials/install-ubuntu-desktop#1-overview
RO S
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n
◦ Ubuntu Installation File
◦ Ubuntu ISO file
RO S
https://releases.ubuntu.com/16.04.7/?_ga=2.48268197.222170929.1598819050-832983989.1579873761
In st a lla tio n
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Checking your OS-ROS distro
RO S
In st a lla tio n
RO S
Enviro n m e nt
Se tup
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
http://wiki.ros.org/Distributions
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Installation steps
http://wiki.ros.org/kinetic/Installation
RO S
In st a lla tio n
RO S
Enviro n m e nt
Se tup
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n ◦ ROS environment setup
◦ Added ROS environment variables automatically to ‘bash’ file
~$echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
RO S
In st a lla tio n
~$source ~/.bashrc
RO S
Enviro n m e nt
Se tup
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Other software that can be use
◦ Terminator
https://blog.arturofm.com/install-terminator-terminal-emulator-in-ubuntu/
RO S
In st a lla tio n
RO S
Enviro n m e nt
Se tup
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Other software that can be use
◦ ATOM
https://tipsonubuntu.com/2016/08/05/install-atom-text-editor-ubuntu-16-04/
RO S
In st a lla tio n
RO S
Enviro n m e nt
Se tup
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Other software that can be use
◦ Cloud storage
https://itsfoss.com/cloud-services-linux/
RO S
In st a lla tio n
RO S
Enviro n m e nt
Se tup
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Creating ROS working Space
◦ Folder where you modify, build, and install ROS packages.
RO S
◦ Use catkin version instead of rosbuild
In st a lla tio n
RO S
Enviro n m e nt
Se tup
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 2 – Setting up ROS
OS Insta lla tio n ◦ Creating ROS working Space
◦ Several ways to create working space
RO S
◦ from terminal:
In st a lla tio n
$mkdir –p ~/name_of_working_space/src
$cd ~/name_of_working_space/
RO S
$catkin_make
Enviro n m e nt
Se tup
RO S Su p p o rt
So ftw a re
In st a lla tio n
C re a ting ROS
Wo rking
Sp a c e
PART 3 – ROS
COMMAND
ROS She ll PART 3 – ROS COMMAND
Command in shell environment is to perform ROS task
ROS Exe c utio n
Task such as file system, editing, building, debugging source codes, package
management, etc.
ROS Ca tkin
ROS Pa c ka g e
https://w3.cs.jmu.edu/spragunr/CS354_S19/handouts/ROSCheatsheet.pdf
ROS She ll PART 3 – ROS SHELL
Also called ‘rosbash’
ROS Exe c utio n
Allow to used the bash shell command commonly used in Linux for ROS
environment.
Command Description
ROS Ca tkin
roscd Move to the directory of the designated ROS package
rosls Check file list of ROS package
rosed Edit file of ROS package
ROS Pa c ka g e roscp Copy file of ROS package
rospd Add directory to the ROS directory index
rosd Check the ROS directory index
ROS She ll PART 3 – ROS EXCUTION
Control the execution of ROS nodes
ROS Exe c utio n
Command Description
roscore Run ROS master + rosout (record log) + parameter server
ROS Info rm a tio n
rosrun Run specific ROS node
roslaunch Run ROS master + Launch multiple nodes and configuration
rosclean Delete ROS log file
ROS Ca tkin
ROS Pa c ka g e
ROS She ll PART 3 – ROS EXCUTION (ROSCORE)
roscore is a collection of nodes and programs that are pre-requisites of a ROS-based
ROS Exe c utio n system.
roscore will start up:
a ROS Master
ROS Info rm a tio n a ROS Parameter Server
a rosout logging node
Syntax:
ROS Ca tkin
$ roscore
ROS Pa c ka g e
ROS She ll PART 3 – ROS EXCUTION (ROSRUN)
rosrun allow user to run executable script / file.
ROS Exe c utio n Required ‘roscore’ to be executable first
Syntax:
$ rosrun <package> <executable file/script
ROS Info rm a tio n
Example:
ROS Ca tkin $ rosrun turtlesim turtlesim_node
ROS Pa c ka g e
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
ROS Ca tkin
Example:
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
ROS Pa c ka g e
ROS She ll PART 3 – ROS Information
Check information regarding topics, services, nodes, parameter, etc.
ROS Exe c utio n
Command Description
rostopic Check ROS topic information
ROS Info rm a tio n
rosservice Check ROS service information
rosnode Check ROS node information
rosparam Check and edit ROS parameter information
ROS Ca tkin
ROS Ca tkin
ROS Pa c ka g e
ROS She ll PART 3 – ROS Information (ROSTOPIC)
Let’s do:
ROS Exe c utio n
Open terminal
$ roscore
ROS Ca tkin
ROS Pa c ka g e
ROS She ll PART 3 – ROS Information (ROSNODE)
Example of usage:
ROS Exe c utio n
Open terminal
$ roscore
ROS Ca tkin
Open new terminal
$ rosrun turtlesim turtlesim_node
Do it in other way……
ROS She ll PART 3 – ROS Information (ROSNODE)
Example of usage:
ROS Exe c utio n
Open terminal
$ roscore
ROS Ca tkin
Open new terminal
$ rosrun turtlesim turtlesim_node
Refresh rqt_graph
ROS Pa c ka g e
Do it in other way……
ROS She ll PART 3 – ROS CATKIN
Used when building a package using the catkin build system.
ROS Exe c utio n
Command Description
ROS Ca tkin
ROS Pa c ka g e
ROS She ll PART 3 – ROS CATKIN (catkin_make)
‘catkin_make’ is a command to build a package created by user or a downloaded
ROS Exe c utio n package
$ cd ~/working_space
ROS Info rm a tio n $ catkin_make
ROS Ca tkin
ROS Pa c ka g e
ROS She ll PART 3 – ROS PACKAGE
Used to manage ROS packages
ROS Exe c utio n
Command Description
rospack View information regarding a specific ROS package
rosinstall Install additional ROS packages
ROS Info rm a tio n
rosdep Install dependency package of the ROS corresponding package
roslocate Show information of ROS package
roscreate-pkg Automatic creation of ROS package (similar with ‘catkin_create_pkg’ but for
ROS Ca tkin
‘rosbuild’ system
rosmake Build ros package (similar with ‘catkin_make’)
ROS Pa c ka g e
ROS She ll PART 3 – PLAY AROUND WITH ROS
Run ‘roscore’
ROS Exe c utio n
Run ‘rqt_graph’
Run turtlesim node
ROS Info rm a tio n
Run turtlesim teleop node
ROS Ca tkin
ROS Pa c ka g e