ROS: A Minimum Overview
What's ROS? †
- A middleware
that helps to make a big system
by combining small programs (nodes). - ROS provides:
- Communication ways between nodes.
- Tools to create nodes and ROS system.
- Why do we use ROS?
- For using a lot of packages developed by other developers.
- For using ROS-compatible robots and sensors
- Baxter, Sawyer
- PR2
- Motoman
- Dynamixel
- Atlas
- MegaBots
- ...
- For making collaboration with others easy.
- For integrating C++ and Python programs.
Concepts †
- Node
is an executable whose code is written in C++, Python, etc.
It should contain some "ROS magic code" to become a ROS node.- Nodes can be executed on different computers.
- Two communication ways of nodes:
- Data-sending type:
Any type of data can be sent from a node to other nodes.
A publisher is a ROS magic (or a "port") on a sending node to send data.
A subscriber is a ROS magic (or a "port") on a receiving node to receive data.
Each node has any number of publishers and subscribers.
The data is identified by a topic (name), and its type (integer, string, etc.) is called a message.
node_A.publisher_a ---<topic>--→ node_B.subscriber_b - Function-call type:
A node can call a function of another node. There may be a return value.
The function is called a service.
A service server is a ROS magic (or a "port") on a node that provides the service.
A service client is a ROS magic (or a "port") on a node that uses the service.
Each node has any number of service servers and service clients.
A service consists of a request (parameters) and a response (return value).
node_A.service_client_a ---<request>--→ node_B.service_server_b
node_A.service_client_a ←--<response>--- node_B.service_server_b
- Data-sending type:
- Launch file
is a script (XML) to execute multiple nodes at once. - Package
is a unit of related things of ROS.- Package is a set of node source codes, definitions of messages and services, launch files, package descriptions, and some extra files.
- ROS identifies a node type, a launch file, a message, and a service by /PACKAGE_NAME/NODE_NAME and so on.
- Package is used to distribute a ROS software. See the list of ROS packages.
Tools †
The following programs are command-line tools for ROS. Execute a command with -help option to see the usage.
- roscore: A core program of ROS, which launches a ROS master. Execute roscore before executing nodes.
- rosrun: Execute a node.
- roslaunch: Execute a launch file. roslaunch automatically executes roscore.
- rosnode: Print information about ROS nodes.
- rostopic: Print information about ROS topics.
- rosservice: Print information about ROS services.
- rosmsg: Print information about ROS message types.
- rossrv: Print information about ROS service types.
- rospack: Print information about ROS packages.
- roscreate-pkg: Create a new ROS package.
- rosbag: Record and play ROS topics.