Important concepts
of ROS
Textbook
P. 40~89
1
Contents
I. ROS terminology
II. Message communication
III. Message
IV. Name
V. Coordinate transformation (TF)
VI. Client library
VII. Communication between heterogeneous devices
VIII. File system
Textbook
IX. Build system P. 40~89
2
Robot operating system ROS term!
3
ROS terms
Node
The smallest unit of executable processors. It can be regarded as single executable program.
In ROS, a system is consist of many nodes. Each node transmits and receives data by
message communication.
Package
One or more nodes, information for node execution, etc. Also, bundles of packages are
called as metapackages.
Message
• Data is transmitted and received through message between nodes. Messages can have
various types such as integer, floating point, and boolean. You can also use structures such
as a simple data structure and an array of messages that hold messages in the message.
4
ROS terms Topic, Publisher, Subscriber
Topic
Topic Publisher Subscriber
Odometry (Location information x, y, θ) SLAM
Publisher Subscriber
Subscriber
Publisher Topic Robot A
*Topic
Distance sensor Subscriber
(Obstacle x, y)
Publisher Subscriber Robot B
* 1: 1 Publisher and Subscriber communication is also possible for Topic,
and 1: N, N: 1, N: N communication is also possible depending on the purpose.
http://www.dreamstime.com/illustration/people-talk-listen-tin-can-phone-communication.html 5
ROS terms Service, Service server, Service client
Service request Hey ~ Server!
What time is it now?
Server Client
I'll check it out.
It’s 12 o'clock now!
Service response
Server Client
http://www.dreamstime.com/illustration/people-talk-listen-tin-can-phone-communication.html 6
ROS terms Action, Action server, Action client
Hey ~ Server!
Deliver action goals Do some housework.
I washed the dishes.
Laundry Server Client
Done!
Deliver action feedback
Cleaning (intermediate results)
Done!
Server Client
I finished them all! Deliver action results
Server Client 7
8
Other terms will be explained at the time
when necessary during the course!
9
Message communication
10
Understanding message communication
• The most fundamental technical point of ROS: message
communication among nodes!
master
Node information Node information
node node
1 2
Connection information
Message communication
(topic, service)
11
Understanding message communication
1. Run Master: XMLRPC(XML-Remote Procedure Call)
$ roscore
Master
XMLRPC: server
http://ROS_MASTER_URI:11311
Node information management
12
Understanding message communication
2. Run Subscriber node
$rosrun packagename nodename
Subscriber node information:
/subscriber_node_name,
/topic_name,
Master message_type,
http://ROS_HOSTNAME:1234
XMLRPC: server
http://ROS_MASTER_URI:11311
node information management
Node
2
XMLRPC: client
http://ROS_HOSTNAME:1234
Information subscribe
13
Understanding message communication
3. Run Publisher node
$rosrun packagename nodename
Publisher node information:
/publisher_node_name,
/topic_name,
message_type,
http://ROS_HOSTNAME:5678
Master
Subscriber
Node information
XMLRPC: server
http://ROS_MASTER_URI:11311
Node information management
Node Node
1 2
XMLRPC: client
http://ROS_HOSTNAME:5678
Information publish
14
Understanding message communication
4. Publisher Information
The master informs the subscriber node of the new publisher information.
Master
Publisher Subscriber
Node information Node information
XMLRPC: server
Publisher node information:
/publisher_node_name,
Node Node
/topic_name,
message_type,
http://ROS_HOSTNAME:5678
1 2
XMLRPC: client
http://ROS_HOSTNAME:1234
Subscribe information
15
Understanding message communication
5. Request access to the publisher node
Request TCPROS connection using the publisher information from the master
Master
Node TCPROS connection request
Node
1 2
XMLRPC: server XMLRPC: client
http://ROS_HOSTNAME:5678 http://ROS_HOSTNAME:1234
Publish information Subscribe information
16
Understanding message communication
6. Connection response to subscriber node
Return TCP URI address and port number corresponding to the connection response
Master
Node Node
1 TCPROS connection response 2
(http://ROS_HOSTNAME:3456)
XMLRPC: server XMLRPC: client
http://ROS_HOSTNAME:5678 http://ROS_HOSTNAME:1234
Publish information Subscribe information
17
Understanding message communication
7. TCP Connection
Establish connection with the publisher node using TCPROS.
Master
Node
노드1 Node
노드2
1 2
TCPROS Connection
TCPROS: Server TCPROS : Client
ROS_HOSTNAME:3456 ROS_HOSTNAME:7890
Publish information Subscribe information
18
Understanding message communication
8. Send message
The publisher node sends a message to the subscriber node (topic)
Master
Node Node
1 2
TCPROS: Server TCPROS : Client
ROS_HOSTNAME:3456 ROS_HOSTNAME:7890
Publish information Send message Subscribe information
(Topic)
19
Understanding message communication
In Topic mode, messages are continuously transmitted unless the connection is terminated.
That is, continuity.
Node
노드1 Node
노드2
1 Send message 2
(Topic)
TCPROS: Server TCPROS : Client
ROS_HOSTNAME:3456 ROS_HOSTNAME:7890
Publish information Subscribe information
20
Understanding message communication
9. Service Request and Response
For only once, service request and service response are performed and disconnected from
each other.
Master
Node Node
1 2
TCPROS: server TCPROS : Client
ROS_HOSTNAME:3456 ROS_HOSTNAME:7890
Service response Send/Receive message service request
(Service)
21
Understanding message communication
Unlike the topic, the service connects only once and disconnected after a service request
and a service response are performed. That is, it is one-time.
Send Message
Node (service request) Node
1 Receive message 2
(Service response)
TCPROS: server TCPROS : Client
ROS_HOSTNAME:3456 ROS_HOSTNAME:7890
Service response service request
22
Summing up again!
23
Understanding the message communication concept!
• turtlesim package
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
rosrun rqt_graph rqt_graph
24
Catching the message communication concept!
• 10. Example! turtlesim
Publisher node information: Subscriber node
/teleop_turtle, information :
/turtle1/cmd_vel, /turtlesim,
geomety_msgs/Twist,
②
roscore ① /turtle1/cmd_vel,
http://192.168.4.100:45704 geomety_msgs/Twist,
Master http://192.168.4.100:50051
http://192.168.4.100:11311
Node information management ③
Publisher node information :
/teleop_turtle,
/turtle1/cmd_vel,
geomety_msgs/Twist,
http://192.168.4.100:45704
← ↑↓ → Send Message
/turtle1/cmd_vel
http://192.168.4.100:45704 http://192.168.4.100:50051
turtle_teleop_key Node turtlesim_node Node
Publish information Subscribe information
25
Message?
26
ROS Message
Message communication
Node1
(Topic, Service, Action, Parameter) Node2
Topic
Publisher Subscriber
Service request
Service server Service client
Service response
Action server Deliver action goal Action client
Deliver action feedback
Deliver action result
Parameter
parameter parameter
server
(ROS Master)
Write Read 27
ROS Message
• Message is a type of data travel around nodes
• Topics, services, and actions all use messages
• http://wiki.ros.org/msg
• http://wiki.ros.org/common_msgs
• Simple type
• ex) integer, floating point, boolean
• http://wiki.ros.org/std_msgs
• A simple data structure containing messages in a message
• ex) geometry_msgs/PoseStamped
• http://docs.ros.org/api/geometry_msgs/html/msg/PoseStamped.html
• An array data structure in which messages are listed
• ex) float32[ ] ranges
• ex) sensor_msgs/LaserScan
• http://docs.ros.org/api/sensor_msgs/html/msg/LaserScan.html
28
ROS Message (ex: geometry_msgs/Twist)
← ↑↓ → Send message
/turtle1/cmd_vel
http://192.168.4.100:45704 (geometry_msgs/Twist) http://192.168.4.100:50051
turtle_teleop_key Node turtlesim_node Node
Publish Information Subscribe information
[geometry_msgs/Twist] [geometry_msgs/Vector3]
float64 x
Vector3 linear float64 y
Vector3 angular float64 z
[geometry_msgs/Vector3]
float64 x
float64 y
float64 z
http://docs.ros.org/api/geometry_msgs/html/msg/Twist.html 29
Name, TF
Client Library
Communication between heterogeneous devices
30
Names
• Name
• A unique identifier for a Node or a message (topic, service, action,
parameter)
• ROS supports abstract data types called graphs
• Global
• Use the name as is or prepend a slash (/) to the name.
• Private
• Prepend a tilde (~) to the name
• An example is covered in Chapter 7, ROS Basic Programming, roslaunch.
Node Relative (default) Global Private
/node1 bar -> /bar /bar -> /bar ~bar -> /node1/bar
/wg/node2 bar -> /wg/bar /bar -> /bar ~bar -> /wg/node2/bar
/wg/node3 foo/bar -> /wg/foo/bar /foo/bar -> /foo/bar ~foo/bar -> /wg/node3/foo/bar
31
Coordinate transformation(TF, transform)
• Relative coordinate transformation of each joint
• Indicates the relationship between joints in the form of tree structure
• An example is covered in Chapter 10 TF and Chapter 13 Modeling
32
Client Library
• Supports various programming languages
• roscpp, rospy,roslisp
• rosjava, roscs, roseus, rosgo, roshask, rosnodejs, RobotOS.jl, roslua,
PhaROS, rosR, rosruby, Unreal-Ros-Plugin
• MATLAB for ROS
• LabVIEW for ROS
http://wiki.ros.org/Client%20Libraries https://commons.wikimedia.org/wiki/File:Prog-languages.png 33
Communication between heterogeneous devices
iOS
34
Communication between heterogeneous devices
• Example 1: Transferring images remotely (see Chapter 8, Camera)
• Example 2: Checking the acceleration value of your Android smartphone on your PC (APP)
• Example 3: Controlling TurtleBot with Android Smartphone (APP)
[PC]
[PC]
[Smartphone] [Smartphone]
35
Question Time!
Advertisement #1
Download link
Language:
English, Chinese, Japanese, Korean
“ROS Robot Programming”
A Handbook is written by TurtleBot3 Developers
Advertisement #2
AI Research Starts Here
ROS Official Platform
TurtleBot3 is a new generation mobile robot that’s modular, compact and
customizable. Let's explore ROS and create exciting applications for education,
research and product development.
Direct Link
Advertisement #3
www.robotsource.org
The ‘RobotSource’ community is the space for people making robots.
We hope to be a community where we can share knowledge about robots, share
robot development information and experiences, help each other and collaborate
together. Through this community, we want to realize open robotics without disti
nguishing between students, universities, research institutes and companies.
Join us in the Robot community ~
END.