Transferred from: http://www.arduino.cn/thread-11351-1-1.html
before the development of the ROS code, it is necessary to understand some of the ROS concepts.
first, the system code of ROS is divided into two parts: Main and Universe.
1.main: A core part of Ros, it provides a basic tool, as well as the programming of the core part of the whole Ros.
2.universe: Worldwide code, developed and maintained by Ros community organizations in different countries. One is the code of the library, such as OPENCV, PCL, etc. the upper layer of the library is the code provided from a functional perspective, such as face recognition, they call the underlying library; The topmost code is the application-level code that allows the robot to complete a certain function.
Ros can also be graded in a different way, divided into three levels: compute level, file system level, community level. Here is the illustration.
<ignore_js_op>
first, calculate the chart levelThe calculation diagram is a network diagram of ROS processing data. When the program runs, all processes and the data processing they perform will be represented by a point-to-point network. This level includes several key concepts: node, message, Subject (topic), Service.
<ignore_js_op>
1. Node nodes are some of the processes that perform the task of computing. It's like an application in a computer. You can use nodes to publish messages to make robots move.
2. Message the nodes are communicated by sending messages.
3. Theme
<ignore_js_op>
messages are passed in a publish/subscribe manner. A node can publish messages in a given topic. A node focuses on and subscribes to specific types of data for a topic. There may be multiple nodes publishing or subscribing to a message on the same topic. In general, publishers and subscribers do not understand each other's existence.
This is like a discussion, given the subject of a discussion. Then a group of people added to the discussion, which is called subscription. And each participant is a node. In the discussion some people publish the message (publish), some people just listen, do not speak (subscribe). The person who speaks and the person who listens does not necessarily know.
4. ServiceThere are two ways to communicate in Ros: one is to communicate between nodes above by posting/subscribing to the topic. There is also the service, in this way: one for the request, one for the response. This is similar to a Web server.
On the basis of the above concept, a controller is needed to enable all nodes to be executed methodically, which is a Ros controller (Ros Master).
ROS Master provides a list of registrations and lookups of other calculated charts via RPC (remote Procedure call Protocol, a remoting procedure invocation). Without a controller, the node will not be able to find other nodes, exchange messages, or invoke services.
For example, the model for controlling node subscriptions and publishing messages is as follows:
<ignore_js_op>
The ROS Controller stores registration information for the subject and services for the ROS node. Nodes communicate with the controller to report their registration information. When these nodes communicate with the controller, they can receive information about other registers and nodes and establish a connection with other registered nodes. The controller also feeds back these nodes when these registration information changes, allowing the node to dynamically create a connection to the new node.
The connection between the node and the node is straightforward, and the controller provides only the query information, just like a DNS server. Node subscription a topic will require a connection to the node that publishes the topic, and the connection will be established on the basis of the consent Connection Agreement.
another: Ros Controller control Services:
<ignore_js_op>
Second, the file system level
The Ros file system level refers to the form of Ros source code that is viewed on the hard disk.
It includes two of the most basic concepts: package and manifest, which are packages and manifest files.
The package is the most basic unit for organizing Ros code, and each package can include library files, executable files, scripts, and some other files.
The manifest file is a description of the package's related information. He provides the dependencies between packages, as well as the meta-information of a package, such as version, maintenance, and licensing information.
third, community-level
the community-level concept of ROS is a manifestation of code publishing on Ros networks.
a federated system of code libraries. So that collaboration can also be distributed. This design from the file system level to the community level makes it possible to independently develop and implement work. Because of this distributed structure, the rapid development of ROS, the number of packets in the software warehouse increased exponentially.
Robot operating System (ROS) Tutorial 4:ros frame "Turn"